Skip to content
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

Merged
merged 4 commits into from
Sep 6, 2023

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Sep 6, 2023

Summary

This broke for reporters not reporting the new runtime option in https://github.com/jestjs/jest/pull/9366/files#diff-13b8119e2dc016b1f90c8f3dff4d9783a4ab4513ff65e87b3200a7deb3d07427

Brought 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.

@netlify
Copy link

netlify bot commented Sep 6, 2023

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 841f722
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/64f825ae862c7800085af6b0
😎 Deploy Preview https://deploy-preview-14473--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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;
Copy link
Member Author

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,
Copy link
Member Author

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 😅

@SimenB SimenB changed the title fix(test-scheduler): correctly figure out test runtime fix(test-sequencer): correctly figure out test runtime Sep 6, 2023
@SimenB SimenB merged commit 4f2807c into jestjs:main Sep 6, 2023
88 of 89 checks passed
@SimenB SimenB deleted the fix-test-runtime-calculation branch September 6, 2023 08:00
@SimenB
Copy link
Member Author

SimenB commented Sep 12, 2023

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant