-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix(browser): fix updating snapshot during watch mode #4867
fix(browser): fix updating snapshot during watch mode #4867
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 canceled.
|
|
||
test.after(async () => { | ||
// force exitCode mutated by vitest | ||
process.exitCode = 0 |
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.
This seems sketchy. What if exitCode
was mutated by node:test
? Why Vitest mutates exitCode
?
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 didn't investigate much but I meant to do something similar as runVitest
test util here:
vitest/test/test-utils/index.ts
Lines 40 to 42 in 044c738
exitCode = process.exitCode | |
process.exitCode = 0 | |
process.exit = exit |
I'll look into more detail what exactly is happening with exit code.
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 refined some assertions to be more precise about process.exitCode
d2366e8
Why Vitest mutates exitCode?
Vitest sets process.exitCode = 1
whenever test failed during runtFiles
:
vitest/packages/vitest/src/node/core.ts
Lines 505 to 506 in d2366e8
if (hasFailed(files)) | |
process.exitCode = 1 |
EDIT: I further refactored by introducing wrapWithExitCode
utility ccfa85a
|
Actually I also need to be careful with automatic vitest/packages/browser/src/node/providers/webdriver.ts Lines 93 to 95 in 3d18efd
Test flaky etc... there are a few things to work out, so I'll put my PRs back to draft. |
Thanks! |
Description
Closes #4865
It might be a little tough to automate a test for this but I'll try something.
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:
.