vitest 3 finishes green then hangs for 10s and warns about closing Vitest
340 tests, 6.2 seconds of actual test time, all passing. Then the process sits there doing nothing, eventually complains that closing timed out and that something is probably keeping the process alive, and exits.
In CI the job takes 90 seconds because of the hang, and roughly one run in ten never exits at all and gets killed at the six minute job timeout.
--pool=forks did not change anything. Nothing in the tests opens a connection - the database layer is mocked.
@thermal_theo · 2w ago
For the things you open on purpose, use the teardown hooks rather than hoping.
globalSetupcan return a function that runs at the very end - that is where servers and pools you started deliberately get closed. Anything per-file goes inafterAllin a setup file.The rule I use: if a test file imports it and it has a
close()orend(), something in that file is responsible for calling it.Reply
Report