-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
More than maxConcurrency number of hooks can run in parallel.
Reproduction
package.json
{
"name": "vitest",
"version": "1.0.0",
"description": "",
"license": "ISC",
"author": "",
"type": "commonjs",
"devDependencies": {
"vitest": "^3.2.4"
}
}a.test.js
import { beforeAll, describe, it } from 'vitest';
async function sleep(ms=1000) {
return new Promise(resolve => setTimeout(resolve, ms));
}
describe.concurrent('Test Suite', () => {
describe.for(["a", "b"])('$0', (name) => {
beforeAll(async () => {
console.log(`Running beforeAll for ${name}`);
await sleep();
});
it(`test ${name} 1`, async () => {
});
});
});$ npm exec -- vitest run --max-concurrency=1 a.test.js
RUN v3.2.4 <snip>
stdout | a.test.js > Test Suite > 'b'
Running beforeAll for a
Running beforeAll for b
✓ a.test.js (2 tests) 1008ms
✓ Test Suite > 'a' > test a 1 2ms
✓ Test Suite > 'b' > test b 1 0ms
Test Files 1 passed (1)
Tests 2 passed (2)
Start at 09:50:21
Duration 1.26s (transform 17ms, setup 0ms, collect 12ms, tests 1.01s, environment 0ms, prepare 59ms)I would expect the test to run for at least 2 seconds, because the calls to sleep should not be run in parallel with --max-concurrency=1.
System Info
Not relevantUsed Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Type
Projects
Status
Approved