Skip to content

chore: fix results formatting for missing totalDuration #1368

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

Merged

Conversation

MikeMcC399
Copy link
Collaborator

Issue

Offline linting shows a violation of the ESLint rule no-constant-binary-expression for

`${testResults.totalDuration / 1000}s` || ''

If testResults.totalDuration is undefined, then

``${testResults.totalDuration / 1000}s || ''

produces NaNs not an empty string.

Change

If testResults.totalDuration is undefined, then fallback to default of displaying 0s.

@MikeMcC399 MikeMcC399 added the bug Something isn't working label Feb 25, 2025
@MikeMcC399 MikeMcC399 self-assigned this Feb 25, 2025
@cypress-app-bot
Copy link

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Feb 25, 2025

Verification

"Duration" is still correctly displayed when it is available:

image

Normally "Duration" should always be available, so the corrected code only comes into play if there is an error elsewhere.

@MikeMcC399 MikeMcC399 marked this pull request as ready for review February 25, 2025 11:04
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

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

Thanks! Good catch.

@jennifer-shehane jennifer-shehane merged commit f465355 into cypress-io:master Feb 25, 2025
76 checks passed
@MikeMcC399
Copy link
Collaborator Author

@jennifer-shehane

Thanks! Good catch.

I will start to add some built-in linting to the repo as the next step. I would not have caught this without ESLint!

@MikeMcC399 MikeMcC399 deleted the fix/total-duration-missing branch February 25, 2025 14:35
Copy link

🎉 This PR is included in version 6.7.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants