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

test: run against ESLint v9 #926

Merged
merged 8 commits into from
Oct 18, 2024
Merged

test: run against ESLint v9 #926

merged 8 commits into from
Oct 18, 2024

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Aug 14, 2024

Checks

Changes

  • introduces a new "flat compat" rule tester that accepts tests written for legacy config, and automatically converts them to flat config when running against ESLint v9
    • this is a class I have used in eslint-plugin-jest, eslint-plugin-jest-dom, and eslint-plugin-jest-extended with great successful
  • updates tests to pass when using ESLint v9
  • updates CI to run test suite against ESLint v9

Context

Before saying the plugin officially supports ESLint v9, it should be testing against v9 which in turn requires accounting for v9's defaulting to flat config and the improvements that have been made to the rule tester to help plugin authors catch bugs.

Besides flat config in general, the two notable changes to the rule tester that require changes to this test suite are:

  • it's now an error to have output that matches code
  • it's now an error to have duplicate cases

There's only a couple of occurrences of that first one and the fix is to just specify null instead which means "this rule supports autofix, but for this test case it does not do anything".

The second though requires a lot more work especially because of how much mapping this test suite does meaning addressing them in full would have huge changes to the layout so instead for now I've made all the tests unique typically by adding a comment that mentions the testing framework whose loop they're part of - ideally though a number of these tests should be restructured to pull such cases out of the mapping loops, which is something I'm happy to help with via follow-up and parallel PRs.

I have also cherry-picked the straightforward removal of a number of duplicates into #927 which if landed first would help reduce the overall diff of this pull request.

@G-Rath G-Rath mentioned this pull request Aug 14, 2024
1 task
@G-Rath G-Rath force-pushed the test-v9 branch 2 times, most recently from cea93a4 to 64745f1 Compare August 14, 2024 21:03
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.33%. Comparing base (93a6ab9) to head (8d487d5).
Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #926      +/-   ##
==========================================
+ Coverage   96.23%   96.33%   +0.09%     
==========================================
  Files          44       46       +2     
  Lines        2419     2481      +62     
  Branches     1000     1028      +28     
==========================================
+ Hits         2328     2390      +62     
  Misses         91       91              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@G-Rath G-Rath force-pushed the test-v9 branch 6 times, most recently from 41baf4e to aeda1af Compare August 15, 2024 20:53
@G-Rath G-Rath mentioned this pull request Aug 15, 2024
1 task
@Belco90 Belco90 self-requested a review October 17, 2024 08:26
Copy link
Member

@Belco90 Belco90 left a comment

Choose a reason for hiding this comment

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

The changes LGTM, but I'll give it another review after being rebased.

.github/workflows/verifications.yml Outdated Show resolved Hide resolved
.github/workflows/verifications.yml Show resolved Hide resolved
@G-Rath G-Rath force-pushed the test-v9 branch 2 times, most recently from f8a8bfb to 1e22221 Compare October 17, 2024 18:32
@G-Rath G-Rath marked this pull request as ready for review October 17, 2024 22:46
@G-Rath G-Rath requested a review from Belco90 October 17, 2024 22:46
MichaelDeBoey
MichaelDeBoey previously approved these changes Oct 17, 2024
Copy link
Member

@MichaelDeBoey MichaelDeBoey left a comment

Choose a reason for hiding this comment

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

Some minor tweaks to the comments to make them consistent all over the place, but nothing big

tests/lib/rules/await-async-events.test.ts Outdated Show resolved Hide resolved
tests/lib/rules/await-async-events.test.ts Outdated Show resolved Hide resolved
tests/lib/rules/await-async-utils.test.ts Outdated Show resolved Hide resolved
tests/lib/rules/await-async-utils.test.ts Outdated Show resolved Hide resolved
tests/lib/rules/await-async-utils.test.ts Outdated Show resolved Hide resolved
tests/lib/rules/await-async-utils.test.ts Outdated Show resolved Hide resolved
tests/lib/rules/await-async-utils.test.ts Outdated Show resolved Hide resolved
tests/lib/rules/await-async-utils.test.ts Outdated Show resolved Hide resolved
Copy link
Member

@Belco90 Belco90 left a comment

Choose a reason for hiding this comment

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

Great job 👏

@Belco90 Belco90 added this pull request to the merge queue Oct 18, 2024
Merged via the queue into testing-library:main with commit 9a4d7e9 Oct 18, 2024
41 checks passed
@G-Rath G-Rath deleted the test-v9 branch October 18, 2024 01:20
Copy link

🎉 This PR is included in version 6.4.0 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants