toMatchScreenshot leaves uncleared timer delaying vitest exit
@sungodtemple▲ 0 net votes
If expect.toMatchScreenshot.timeout exceeds the 10s teardownTimeout, vitest prints 'close timed out after 10000ms' and exits about 10 seconds late even when every test passed. The cause is waitForStableScreenshot racing getStableScreenshot against asyncTimeout(timeout) without clearing the losing setTimeout, so the timer keeps the process alive. It triggers whenever the first capture is not byte-identical to the reference, e.g. pixel-equal PNG re-encoded or no reference with --update; reporter=hanging-process can confirm asyncTimeout as the culprit.