Skip to content

chore: update all test scripts to remove coverage flag #10582

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
merged 9 commits into from
Feb 27, 2025

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Dec 31, 2024

Changes test of all packages to run without coverage, then alters the following:

  • CI explicitly passes --coverage where needed
  • local development must manually pass --coverage (e.g. npm test -- --coverage) to enable coverage
  • packages which once relied on the root repo's jest now correctly have it as a devDependency

Before this change, test behaved like test --coverage (i.e. packages had coverage enabled in it). In CI, we then forced coverage off in some situations by passing a flag: npm run test -- --coverage=false.

This resulted in commands like jest --coverage --coverage=false.

While jest is happy with this, vitest is not. Given we are likely to move to vitest, it is worth fixing this ahead of time.

PR Checklist

Adds a `test-coverage` script to each package.

With this change, each package has these two scripts:

- `test` - run tests with coverage disabled
- `test-coverage` - run tests with coverage enabled (_if_ the package
  wants to support coverage)

Before this change, `test` behaved like `test-coverage` (i.e. packages
had coverage enabled in it). In CI, we then forced coverage off in some
situations by passing a flag: `npm run test -- --coverage=false`.

This resulted in commands like `jest --coverage --coverage=false`.

While jest is happy with this, vitest is not. Given we are likely to
move to vitest, it is worth fixing this ahead of time.
@typescript-eslint
Copy link
Contributor

Thanks for the PR, @43081j!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Dec 31, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 479af6d
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/67c00942c31f6a000860e622
😎 Deploy Preview https://deploy-preview-10582--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

nx-cloud bot commented Dec 31, 2024

View your CI Pipeline Execution ↗ for commit 479af6d.

Command Status Duration Result
nx run-many --target=build --exclude website --... ✅ Succeeded 49s View ↗
nx run-many --target=clean ✅ Succeeded 10s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-27 06:52:37 UTC

Copy link

codecov bot commented Dec 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.43%. Comparing base (c910ac1) to head (479af6d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10582      +/-   ##
==========================================
+ Coverage   87.27%   87.43%   +0.15%     
==========================================
  Files         453      468      +15     
  Lines       15833    16025     +192     
  Branches     4639     4639              
==========================================
+ Hits        13819    14011     +192     
  Misses       1658     1658              
  Partials      356      356              
Flag Coverage Δ
unittest 87.43% <ø> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 15 files with indirect coverage changes

@kirkwaiblinger
Copy link
Member

Hey @43081j , we do need to ask that you follow the template and contributing guide

- Only send pull requests that resolve [open, unassigned issues marked as accepting prs](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+is%3Aopen+label%3A%22accepting+prs%22+no%3Aassignee)
   - One exception: extremely minor documentation typos

For something like this please file an issue so we can discuss

@kirkwaiblinger kirkwaiblinger added the please fill out the template we have the processes for good reasons 😔 label Jan 3, 2025
@kirkwaiblinger
Copy link
Member

For something like this please file an issue so we can discuss

Do feel free to link a draft PR on the issue, though, if it's a helpful aid to the discussion

@43081j
Copy link
Contributor Author

43081j commented Jan 4, 2025

No worries

As mentioned, this came out of a related PR so didn't have it's own issue. Happy to make one, the guidelines certainly were read, I just didn't realise this needed it's own issue

Will keep the branch around since it is likely we will need it

@43081j
Copy link
Contributor Author

43081j commented Jan 4, 2025

#10607

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2025
@kirkwaiblinger kirkwaiblinger mentioned this pull request Jan 17, 2025
14 tasks
@kirkwaiblinger kirkwaiblinger removed the please fill out the template we have the processes for good reasons 😔 label Jan 20, 2025
@kirkwaiblinger
Copy link
Member

reopening following discussion in #10579 and #7112 (comment)

@typescript-eslint typescript-eslint unlocked this conversation Jan 20, 2025
@43081j
Copy link
Contributor Author

43081j commented Jan 20, 2025

in the various PRs by @aryaemami59, an environment variable has been used instead of having two scripts.

that may make more sense, if we don't care about being able to locally run with coverage (and instead we'd manually pass --coverage when we run it ourselves)

if we do that, i'm happy to update this PR to make use of the COLLECT_COVERAGE env var we already have in our CI

either way, we remove the --coverage flag. we just need to decide if we'd rather have runnable scripts or an env variable

probably a decision for you @kirkwaiblinger and @JoshuaKGoldberg

if you decide an env var is the way to go, we have #10689

@aryaemami59
Copy link
Contributor

@43081j Honestly I think a test-coverage script would be better and will probably cause less issues as it's more explicit and can be used more reliably locally.

@43081j
Copy link
Contributor Author

43081j commented Jan 23, 2025

@kirkwaiblinger @JoshuaKGoldberg any chance we can get some movement on this?

it will unblock the rest of the vitest work. there are still pieces of the larger PRs that can be cut out into individual changes, but this needs to land first

@JoshuaKGoldberg
Copy link
Member

For visibility, I'm stuck doing a few other projects this week - but if nobody's moved it forward by early next week I can try to find some time. Thanks for pushing on it! ❤️

@kirkwaiblinger
Copy link
Member

Hey! I also am not able to dive into this area at the moment, several things going on in my personal life and such. I expect it will be at least until the weekend but potentially next week. We definitely appreciate your work on this and do plan to unblock you as soon as we can. Thanks for understanding! 🙏

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Thanks for pushing on this! I think the general direction of removing --coverage out of the test scripts is good. One request that's blocking: I think we can unify them altogether to not mention --coverage in package.jsons at all, once ast-spec is fixed?

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Jan 28, 2025
@43081j
Copy link
Contributor Author

43081j commented Feb 25, 2025

@kirkwaiblinger i think disabling the flag sorted what you were seeing

can you double check?

@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Feb 25, 2025
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

I'll defer to Kirk for a full review, just posting to get you feedback quickly - I think we can trim away just a bit more?

Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

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

I think we're very close! Important blocker for me is just that yarn test and yarn test -- --coverage must both pass locally.

Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

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

I've gone ahead and pushed the tweaks requested in #10582 (review) to your branch, so I think we're good to go. @43081j let us know if there's any concerns!

@kirkwaiblinger kirkwaiblinger added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Feb 27, 2025
@43081j
Copy link
Contributor Author

43081j commented Feb 27, 2025

Looks good to me. If there are any other changes, please do just push them so we can get this merged and reduce the iteration time

Will be good to get this merged 👍

@kirkwaiblinger kirkwaiblinger merged commit 7c88d26 into typescript-eslint:main Feb 27, 2025
79 checks passed
@kirkwaiblinger
Copy link
Member

@43081j Excited to be merging! Thanks for your work on this!

@43081j 43081j deleted the coverage-ci branch February 27, 2025 19:36
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants