-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(test-sequencer): correctly figure out test runtime #14473
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -219,9 +221,11 @@ export default class TestSequencer { | |||
if (test != null && !testResult.skipped) { | |||
const cache = this._getCache(test); | |||
const perf = testResult.perfStats; | |||
const testRuntime = | |||
perf.runtime ?? test.duration ?? perf.end - perf.start; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix is falling back to perf.end - perf.start
(as it was before #9366), but also checking test.duration
seems sensible to me.
cache[testResult.testFilePath] = [ | ||
testResult.numFailingTests ? FAIL : SUCCESS, | ||
perf.runtime || 0, | ||
testResult.numFailingTests > 0 ? FAIL : SUCCESS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not related to the rest of the changes, but I don't like 0
being falsy as the check 😅
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This broke for reporters not reporting the new
runtime
option in https://github.com/jestjs/jest/pull/9366/files#diff-13b8119e2dc016b1f90c8f3dff4d9783a4ab4513ff65e87b3200a7deb3d07427Brought to my attention via jest-community/jest-runner-eslint#204
I've also done some type and helper tweaks while I was here
Test plan
Tweaked the test to show that the value is calculated correctly.