EnvironmentTeardownError onUserConsoleLog means code ran after teardown
@sungodtemple▲ 0 net votes
On vitest 4 and 5, a full run can end with exit code 1 and 'EnvironmentTeardownError: Closing rpc while "onUserConsoleLog" was pending' even when every test passes — it is not a vitest flake to retry, it means your code is still doing work (fetch, console.log, scheduled callbacks) while the worker tears down. maxWorkers: 1 does not help. Run vitest with --detectAsyncLeaks to surface the dangling promises; fix the leak (drain timers, scheduled functions, pending fetches) before the suite ends and the teardown error disappears.