Skip to content

Rule: disallow identical tests #5

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

Closed
not-an-aardvark opened this issue Apr 6, 2017 · 0 comments · Fixed by #11
Closed

Rule: disallow identical tests #5

not-an-aardvark opened this issue Apr 6, 2017 · 0 comments · Fixed by #11

Comments

@not-an-aardvark
Copy link
Contributor

When a rule has a lot of tests, it's sometimes difficult to tell if any tests are duplicates. This rule would warn if any test cases have the same properties.

Incorrect code for this rule:

/* eslint eslint-plugin/no-identical-tests: error */

ruleTester.run("foo", rule, {
  valid: [
    { code: "foo", options: ["bar"] },
    { code: "somethingElse", options: ["bar"] },
    { code: "foo", options: ["bar"] }
  ],
  invalid: []
});

To be honest, I'm not sure how useful this would be in practice -- two test cases might be basically equivalent as far as the rule's logic is concerned, but have slight differences such as whitespace, and eslint-plugin-eslint-plugin wouldn't be able to tell that the cases were equivalent.

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

Successfully merging a pull request may close this issue.

1 participant