-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(browser): add commands to communicate betweens server and the browser #5097
feat(browser): add commands to communicate betweens server and the browser #5097
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 canceled.
|
015216e
to
7844f6d
Compare
Oh crap this is cool! big like 🚀 |
it seems like all file paths are resolved relative to each test file for |
It is a documented behaviour. If you have feature requests, open a new issue. Comments to one year old PRs are not a good place to discuss this. |
Description
Fixes #4918
This PR adds a
@vitest/browser/context
module that you can import commands and other utilities from. By default, Vitest provides these commands based on Web Test Runner:The
@vitest/browser/context
module also exposes other variables:Example of using a built-in command:
Note
All fs related operations require the file to be inside the root. This option is controlled by server.fs
You can add your own commands by adding them to
browser.commands
option:Using inside a test:
TODO:
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.