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 reporting test durations #205

Merged
merged 1 commit into from
Sep 6, 2023
Merged

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Sep 2, 2023

Fixes #204.

Jest appears to have changed the format of TestResult. What was perfStats.duration is now perfStats.runtime:

https://github.com/jestjs/jest/blob/edeecfae240bfd54b33f3c9eae156bd157447e5a/packages/jest-test-result/src/types.ts#L90-L122

Adding runtime property solves the problem.

I've left the duration property in place too in case that provides compatibility with older versions of Jest.

@SimenB
Copy link
Member

SimenB commented Sep 3, 2023

Seems weird to me Jest has both of these - when would they differ?

EDIT: Hmm, seems duration is the odd one out. At least the PR adding duration didn't touch it: jestjs/jest#9366

Comment on lines 75 to +76
duration: endTime - startTime,
runtime: endTime - startTime,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both of these seems silly to me - I'd assume Jest could figure it out on its own... I'll dig into this a bit more tomorrow and attempt to figure out why this would be needed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix in Jest is jestjs/jest#14473, but that would only fix it for Jest 29 - this regressed in Jest 26

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@SimenB SimenB merged commit 4b1bdb8 into jest-community:main Sep 6, 2023
90 checks passed
@SimenB
Copy link
Member

SimenB commented Sep 6, 2023

@overlookmotel
Copy link
Contributor Author

Thanks for tracking it down and getting this merged so swiftly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Files linted in random sequence
2 participants