vmThreads does not fail CI step when a test fails #10559
Replies: 3 comments
|
The combination of symptoms — exit code 0 ( 1. Check for a stray // setupFiles
const realExit = process.exit;
process.exit = ((code?: number) => {
console.trace(`process.exit(${code}) called`);
return realExit(code as never);
}) as typeof process.exit;2. Check for OOM worker crashes. 3. The better fix for both problems: test: {
pool: 'forks',
isolate: false, // big speedup; requires tests not to rely on per-file isolation
// maxWorkers: tune to your CI runner
}This keeps real process isolation (crashes are contained and reported, exit codes are reliable — which is exactly what your CI step needs) while typically landing in the same ballpark as 4. Belt-and-braces for CI: since you already emit junit, make the step's pass/fail come from the XML too (e.g. a junit-report action with If you can grab the last ~50 lines of the vmThreads CI log (right before |
|
Worth double-checking the pool choice here, since
A crashed thread worker not surfacing as a nonzero exit code, rather than a proper failure count, is consistent with the process dying mid-run before Vitest's own reporter gets to summarize results, exactly the "Done in 397.30s" with no stats and truncated output described here. Two things worth trying instead of
Also worth a quick sanity check independent of the pool: confirming the GHA step's actual exit code ( |
|
I don't think the failing assertion itself is being ignored. The combination of these three symptoms is the important part:
A completed Vitest run should reach reporter finalization, print its test summary, write the final JUnit result, and return a non-zero status when a test fails. Since that final section is missing, I'd treat this as an interrupted run first and an exit-code bug second. There are a few things I'd check to narrow this down. 1. Verify which process is actually returning
|
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I have quite a big project with 400+ test files, sometimes heavy ones, 2500+ test cases. Recently migrated from jest to vitest, and using
pool: vmThreads(the default one is super slow).I explicitly set a test to fail, and the whole GHA step does not fail, though I do see this fail in vitest script. But the job quits with a simple text:
Done in 397.30s.When I run with default pool, I have the whole stats (number of suites, number of tests, etc.)
Strange thing: using vmThreads I don't see all the 4500 lines of the output that I see using the default pool.
I tried multiple configs but I am falling into veeeery slow tests (25 to 31 minutes).
Reproduction
Vite version: 8.0.16
Vitest version: 4.1.8
Script I use:
TZ=Europe/Amsterdam vitest run --reporter=default --reporter=junit --outputFile.junit=./build/junit.xml --maxWorkers=2(the number of workers does not help much; the default one floods the CI runner, =4 is a bit better)Vitest config:
System Info
macOS Tahoe; the CI runner is 8GB ubuntu 4 CPUUsed Package Manager
yarn
Validations
All reactions