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 eslint-plugin-khan tests so that they can be run using jest #1090

Merged
merged 3 commits into from
Dec 9, 2024

Conversation

kevinb-khan
Copy link
Contributor

Summary:

#1085 caused an issue where tests were only running for one of the eslint plugin rules. Thanks @beaesguerra for noticing this. This PR updates our testing setup so that we can use jest to run the eslint-plugin-khan tests instead of mocha. It also fixes a few failures that are due to changes in eslint and RuleTester's behaviour.

Issue: None

Test plan:

  • yarn test

@kevinb-khan kevinb-khan self-assigned this Dec 9, 2024
Copy link

changeset-bot bot commented Dec 9, 2024

🦋 Changeset detected

Latest commit: dc73c80

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@khan-actions-bot khan-actions-bot requested a review from a team December 9, 2024 16:36
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Dec 9, 2024

Gerald

Required Reviewers
  • @Khan/frontend-infra for changes to yarn.lock, .changeset/rotten-spiders-hear.md, .github/workflows/node-ci.yml, config/jest/test-setup.js, config/jest/test.config.js, packages/eslint-plugin-khan/package.json, packages/eslint-plugin-khan/test/rules/array-type-style.test.ts, packages/eslint-plugin-khan/test/rules/jest-async-use-real-timers.test.ts, packages/eslint-plugin-khan/test/rules/jest-await-async-matchers.test.ts, packages/eslint-plugin-khan/test/rules/jest-enzyme-matchers.test.js, packages/eslint-plugin-khan/test/rules/no-one-tuple.test.ts, packages/eslint-plugin-khan/test/rules/react-no-method-jsx-attribute.test.ts, packages/eslint-plugin-khan/test/rules/react-no-subscriptions-before-mount.test.ts, packages/eslint-plugin-khan/test/rules/react-svg-path-precision.test.ts, packages/eslint-plugin-khan/test/rules/sync-tag.test.ts, packages/eslint-plugin-khan/test/rules/ts-no-error-suppressions.test.ts

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

Copy link
Member

@jeresig jeresig left a comment

Choose a reason for hiding this comment

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

Ahh nice - thanks for the fixes!

@kevinb-khan
Copy link
Contributor Author

Ahh nice - thanks for the fixes!

I love that we're able to use RuleTester with jest now. I'll make the same change to services/static/dev/eslint-plugin-static-service at some point so that we can run those tests using GitHub Actions.

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.85%. Comparing base (86caa2d) to head (dc73c80).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1090   +/-   ##
=======================================
  Coverage   99.85%   99.85%           
=======================================
  Files          97       97           
  Lines        1392     1392           
  Branches      351      351           
=======================================
  Hits         1390     1390           
  Misses          1        1           
  Partials        1        1           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 86caa2d...dc73c80. Read the comment docs.

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Size Change: 0 B

Total Size: 4.63 kB

ℹ️ View Unchanged
Filename Size
packages/wonder-stuff-core/dist/browser/es/index.js 1.85 kB
packages/wonder-stuff-sentry/dist/browser/es/index.js 1.65 kB
packages/wonder-stuff-testing/dist/browser/es/index.js 1.12 kB

compressed-size-action

Comment on lines -88 to -95
{
code: `expect(promise).resolves.not.toBe(true);`,

errors: [
{messageId: "asyncMatchers", data: {matchers: ["resolves"]}},
],
output: "await expect(promise).resolves.not.toBe(true);",
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a duplicated test case which jest doesn't like.

@kevinb-khan kevinb-khan merged commit 4cba5ba into main Dec 9, 2024
8 checks passed
@kevinb-khan kevinb-khan deleted the fix-eslint-plugin-tests branch December 9, 2024 16:49
@beaesguerra
Copy link
Member

Thanks for the fix @kevinb-khan ! 🎉

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.

4 participants