You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vitest list exits with code 0 when a test file fails to parse #11145
Since 5.0.0, vitest list parses test files statically by default (#11088). On that path a file that fails to parse is reported as an error, but the command still exits 0.
With a test file that has a syntax error:
npx vitest list # error on stderr, no listing, exit 0
npx vitest list --json # error on stderr, no JSON, exit 0
npx vitest list --no-static-parse # parse error with code frame, exit 1
The --json case is the damaging one. A CI step reading that output gets empty stdout and a success exit code, so a file that does not compile looks like a project with no tests.
Vitest.collect() only sets process.exitCode in the branch that calls collectTests. The static branch returns without it. #11088 also moved the exit code assertion in test/e2e/test/list.test.ts onto --no-static-parse, so nothing covers the default path.
Activity
fix: exit 1 when vitest list fails collection (fix #11145) (#11146)