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
Given a test with an asynchronously resolved fixture, Vitest hangs when the fixture is used in multiple tests concurrently.
Example test:
import { expect, test } from 'vitest';
const myTest = test.extend<{ a: number }>({
a: async ({ task }, use) => {
await new Promise<void>((resolve) => setTimeout(resolve, 200));
console.log('running test', task.id);
await use(0);
console.log('cleaning up test', task.id);
},
});
myTest.concurrent('fixture - test 1', ({ a }) => {
expect(a).toBe(0);
});
myTest.concurrent('fixture - test 2', ({ a }) => {
expect(a).toBe(0);
});
Results of the test:
DEV v1.0.0-beta.3 /home/projects/vitest-dev-vitest-9d9pqh
UI started at http://localhost:51204/__vitest__/
stdout | test/async-fixture.test.ts > fixture - test 2
running test 1084931944_0
running test 1084931944_1
cleaning up test 1084931944_1
❯ test/async-fixture.test.ts (2)
✓ fixture - test 1
✓ fixture - test 2
The first test fixture is never cleaned up, and since the promise returned from the call to use() never resolves, Vitest hangs.
Describe the bug
Given a test with an asynchronously resolved fixture, Vitest hangs when the fixture is used in multiple tests concurrently.
Example test:
Results of the test:
The first test fixture is never cleaned up, and since the promise returned from the call to use() never resolves, Vitest hangs.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-9d9pqh?file=test%2Fasync-fixture.test.ts
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: