Skip to content

fix: Flag assert.equal in module hooks #570

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arensman
Copy link

@arensman arensman commented May 26, 2025

  • Updated no-assert-equal rule to also catch assert.equal in module hooks
  • Moved isInModule into utils (was duplicated around a few places)
  • Added before and after to recognized module hook properties
  • Added test case

Fixes #531

@bmish
Copy link
Member

bmish commented Jun 21, 2025

Just to confirm, it looks like this will be a breaking change, right? I see isModuleHookPropertyKey is used in 4 rules. Can you add a test to each of those rules if it affects them.

@arensman
Copy link
Author

arensman commented Jun 23, 2025

Just to confirm, it looks like this will be a breaking change, right? I see isModuleHookPropertyKey is used in 4 rules. Can you add a test to each of those rules if it affects them.

Yes, that's correct. It fits the category "Minor release > A bug fix in a rule that results in ESLint reporting more errors."
That change improves the rules to detect the before and after hooks. According to QUnit documentation, they have been added with 2.0 and have the same API as beforeEach and afterEach. That's why I'm positive this change is intended.

I've added tests for the other four rules. The tests in no-arrow-tests, no-qunit-start-in-tests, and resolve-async fail without this change. The test in no-setup-teardown passes with and without.

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

Successfully merging this pull request may close these issues.

"qunit/no-assert-equal" does not recognize assert.equal in module hooks
2 participants