-
-
Notifications
You must be signed in to change notification settings - Fork 150
Drop separation between Node.js and browser builds #649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+2,746
−6,164
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1de4bcf
Require Node.js & TS versions that support require(esm)
eemeli fb7de00
Drop imports from node:buffer and node:process outside src/cli.ts
eemeli 90c1b80
Use tsc rather than rollup to produce a single ESM build
eemeli 75a5687
Switch from Jest to Vitest
eemeli 359f680
Use Vitest with Playwright for browser tests
eemeli be05c55
Drop yaml-playground submodule
eemeli 66e3f96
ci: Include test for TS 5.9 compatibility
eemeli 5560f43
Clean up file extensions, .mjs -> .js
eemeli fa93c2d
Explicitly declare most function return types
eemeli 37f19b5
Enable isolatedDeclarations & stripInternal in TS config
eemeli 466f6e9
Use Rolldown to bundle the output files
eemeli 5ff3151
ci: Extend browser connection timeout to 2 min
eemeli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import { resolve } from 'node:path' | ||
| import { env } from 'node:process' | ||
| import { defineConfig } from 'vitest/config' | ||
| import { playwright } from '@vitest/browser-playwright' | ||
|
|
||
| const bsDefaults = { | ||
| project: env.BROWSERSTACK_PROJECT_NAME, | ||
| build: process.env.BROWSERSTACK_BUILD_NAME, | ||
| 'browserstack.idleTimeout': 600, | ||
| 'browserstack.local': 'true', | ||
| 'browserstack.localIdentifier': env.BROWSERSTACK_LOCAL_IDENTIFIER, | ||
| 'browserstack.username': env.BROWSERSTACK_USERNAME, | ||
| 'browserstack.accessKey': env.BROWSERSTACK_ACCESS_KEY || env.BROWSERSTACK_KEY | ||
| } | ||
|
|
||
| const bsProvider = opts => | ||
| playwright({ | ||
| connectOptions: { | ||
| wsEndpoint: `wss://cdp.browserstack.com/playwright?caps=${encodeURIComponent( | ||
| JSON.stringify({ ...bsDefaults, ...opts }) | ||
| )}` | ||
| } | ||
| }) | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| alias: [ | ||
| { | ||
| find: /^yaml/, | ||
| customResolver(path) { | ||
| const name = path.split('/')[1] ?? 'index' | ||
| return resolve(import.meta.dirname, '..', 'dist', `${name}.js`) | ||
| } | ||
| } | ||
| ], | ||
| api: { host: '0.0.0.0' }, | ||
| browser: { | ||
| enabled: true, | ||
| provider: playwright(), | ||
| connectTimeout: 120_000, | ||
| instances: [ | ||
| { | ||
| name: 'Chrome Old', | ||
| browser: 'chromium', | ||
| provider: bsProvider({ browser: 'chrome', browser_version: '93' }) | ||
| }, | ||
| { | ||
| name: 'Chrome New', | ||
| browser: 'chromium', | ||
| provider: bsProvider({ browser: 'chrome', browser_version: 'latest' }) | ||
| }, | ||
| { | ||
| name: 'Firefox Old', | ||
| browser: 'chromium', | ||
| provider: bsProvider({ | ||
| browser: 'playwright-firefox', | ||
| browser_version: '94' | ||
| }) | ||
| }, | ||
| { | ||
| name: 'Firefox New', | ||
| browser: 'chromium', | ||
| provider: bsProvider({ | ||
| browser: 'playwright-firefox', | ||
| browser_version: 'latest' | ||
| }) | ||
| } | ||
| ] | ||
| }, | ||
| globals: true, | ||
| include: ['tests/**/*.{js,ts}'], | ||
| exclude: [ | ||
| 'tests/_*', | ||
| 'tests/artifacts/', | ||
| 'tests/json-test-suite/', | ||
| 'tests/json-test-suite.ts', | ||
| 'tests/yaml-test-suite.ts', | ||
| 'tests/cli.ts' | ||
| ] | ||
| } | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,5 @@ coverage/ | |
| dist/ | ||
| node_modules/ | ||
| /docs-slate/ | ||
| /playground/ | ||
| /tests/json-test-suite/ | ||
| /tests/yaml-test-suite/ | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend to continue using major version specifiers like
[20, 22, 24, latest]because that's more representative to what most users will be running.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
20.19.0, 22.12.0, 24.0.0are meant to catch violations of the minimum supported versions, which are specifically these.In my experience,
latestis the best target for catching issues due to Node.js changes; I've not seen any issues caused by fixes backported to older major versions, which is what20, 22, 24would catch.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, yeah those stable branches are indeed generally very stable, so seems like a fine approach.