fix(browser): fix updating snapshot during watch mode#4867
fix(browser): fix updating snapshot during watch mode#4867sheremet-va merged 17 commits intovitest-dev:mainfrom
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.
This seems sketchy. What if exitCode was mutated by node:test? Why Vitest mutates exitCode?
There was a problem hiding this comment.
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
I'll look into more detail what exactly is happening with exit code.
There was a problem hiding this comment.
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
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.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.