-
Notifications
You must be signed in to change notification settings - Fork 80
test: set up vitest browser mode test environment #11877
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
Conversation
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.
LGTM!
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 likey!
"test": "concurrently \"npm:test:stable\" \"npm:test:experimental\"", | ||
"test:stable": "STABLE_TESTS=true vitest run", | ||
"test:experimental": "EXPERIMENTAL_TESTS=true vitest run --browser.headless", | ||
"test:watch": "npm run test:watch:stable && npm run test:watch:experimental", |
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.
Did you confirm test:watch
works? I don't think test:experimental
will run because test:stable
won't exit. You may need to use concurrently
like the test
script does.
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.
Great catch. Will fix!
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.
Used concurrently
+ passthrough options. One thing to note is that interactive watch mode won't work as before since both test runners might conflict when handling input. I've updated the contributing doc with this info.
Merging! @benelan LMK if there's any additional tweaks needed for the |
**Related Issue:** N/A ## Summary Adds passthrough arg support to `test` script missed in #11877.
**Related Issue:** #11877 ## Summary Make vitest default to the stable tests when the `EXPERIMENTAL_TESTS` environment variable is not set. Previously, `npx vitest` would not find any tests to run. This change fixes the test runner integrations provided by some IDEs (including neovim and vscode). NOTE: We can probably get rid of the `STABLE_TESTS` environment variable with this change.
Related Issue: #11268
Summary
Some of Lumina's testing utils and patterns (e.g.,
mount
) depend or work best on Vitest's experimental browser mode, so this PR enables testing with it. This supports E2E and/or spec tests that would be simpler to write with this mode (e.g., #7060).Tests meant for this mode should use the following naming pattern:
<name>.browser.(spec|e2e).tsx?
(see example).Note: Until browser mode is stable, continue using the usual E2E or spec tests unless a browser-mode test is specifically needed.