test: stop worker-teardown console race from failing unit shards (#39813)

Vitest rejects a console-log RPC still in flight when a worker tears
down, failing a shard whose tests all passed. Ignore only that rejection
(the lost line belongs to a finished file and passed-only shards drop
it anyway), and stop the two specs seen in CI from spawning real git and
wsl.exe in fire-and-forget background work.

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-08 02:55:36 -08:00
committed by GitHub
co-authored by OrcaWin
parent b4a522deeb
commit de3da487fa
3 changed files with 20 additions and 0 deletions
+3
View File
@@ -142,6 +142,9 @@ export default defineConfig({
}
: {}),
projects,
// A finished file's background log can lose the race with worker teardown; only that log line is lost.
onUnhandledError: (error) =>
!(error.name === 'EnvironmentTeardownError' && error.message.includes('"onUserConsoleLog"')),
...(process.platform === 'win32' ? { maxWorkers: 4 } : {})
}
})