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

RuleTester detection seems like it could use improving #248

Closed
G-Rath opened this issue May 1, 2022 · 3 comments · Fixed by #249
Closed

RuleTester detection seems like it could use improving #248

G-Rath opened this issue May 1, 2022 · 3 comments · Fixed by #249
Labels

Comments

@G-Rath
Copy link
Contributor

G-Rath commented May 1, 2022

I've noticed the RuleTester detection logic seems to trip up on what I'd consider common or easy to support cases - the latest was that it didn't flag this test as duplicated because I've got the tests wrapped in a describe.

e.g.

describe('reference tests', () => {
  ruleTester.run('esm', rule, {
    valid: ['not flagged', 'not flagged'],
    invalid: [],
  });
});

ruleTester.run('esm', rule, {
  valid: ['not flagged', 'not flagged'],
  invalid: [],
});

I think there was at least another instance where it didn't seem to pick up alternative names, but it's been a while so can't remember the details.

I've not yet had the time to dig into this that deeply but wanted to open this issue in the meantime to get some discussion going - I'm happy to help with trying to improve the logic.

@bmish
Copy link
Member

bmish commented May 1, 2022

To be clear, are you talking about the no-identical-tests rule?

@G-Rath
Copy link
Contributor Author

G-Rath commented May 1, 2022

That and at least the test case properties rules as they're also impacted in the same way. I've not had the time yet to do any real testing to check how many rules it affects, and to come up with some common cases I think it would be nice to try and support (it might turn out that this is the main one that's easy to do 🤷)

@aladdin-add
Copy link
Contributor

yes, all the tests-related rules were behaving the same way - it is only checking the top-level ruleTester.run(). https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/b685b2aa9bb6c88d752dde7a9ddaf4c03efbc226/lib/utils.js#L389

good to check a few more common cases. 👍

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 a pull request may close this issue.

3 participants