fix(runner): correct per-test duration for concurrent tests#10072
Open
cyphercodes wants to merge 1 commit intovitest-dev:mainfrom
Open
fix(runner): correct per-test duration for concurrent tests#10072cyphercodes wants to merge 1 commit intovitest-dev:mainfrom
cyphercodes wants to merge 1 commit intovitest-dev:mainfrom
Conversation
Fixes incorrect test duration reporting when tests run concurrently with maxConcurrency. The duration now measures actual test execution time instead of including time spent waiting for concurrency slots. Fixes vitest-dev#10069
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes incorrect test duration reporting when tests run concurrently with maxConcurrency.
Problem
When tests run concurrently (e.g., with
describe.concurrentandmaxConcurrency: 1), the reported per-test duration includes time spent waiting for a concurrency slot, not just the actual test execution time. This causes tests that take ~10s each to be reported as taking ~20s each.Solution
Capture the start time right before the test function executes (after acquiring the concurrency slot) instead of at the beginning of
runTest. This ensures the duration reflects actual test execution time.Changes
executionStartvariable to track when test actually starts executingexecutionStartright beforelimitMaxConcurrencycallexecutionStartfor duration calculation instead ofstartFixes #10069