-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
📎 Implement lint/noExclusiveTests
- eslint-plugin-jest/no-focused-tests
, eslint-plugin-mocha/no-exclusive-tests
, eslint-plugin-no-only-tests
#597
Comments
This choice is debatable, so we should really understand the rule's criteria. The original rule is made for mocha only, so should we do the same? What about other testing libraries? For example, tape: https://www.npmjs.com/package/tape#testonlyname-opts-cb, where a user can import |
lint/noExclusiveTests
- eslint-plugin-mocha/no-exclusive-tests
lint/noExclusiveTests
- eslint-plugin-jest/no-focused-tests
, eslint-plugin-mocha/no-exclusive-tests
We can ship a first version which supports the most common usages. I am not fond of tracking potential renaming of these functions because this implies maintaining a list of supported frameworks. However, some rules could be dedicated to a test framework. Since most of test frameworks rely on implicit globals 🤮, we should add a way to declare the use of a framework in the configuration or a way to detect it (e.g. via package.json dev dependencies). |
Sounds like a good plan! |
Maybe could be a configuration option, but having a comment above a skipped test explaining why it was skipped can be extremely useful. Is this something we could consider? |
You can already use an ignore comment with the reason. This should fulfill your request? |
I think this rule will allow you to use E.g. this rule will stop this: describe.only("test", () => {}); But you can add a comment here: // biome-ignore lint/suspicious/noExclusiveTests: I really want to run this test only!
describe.only("test", () => {}); But we will still be allowing this: describe.skip("test", () => {}); I'm wondering if a config option requires a comment above a skipped test (not a .only test), for example: describe.skip("test", () => {}); // lint failure - skipped test requires a comment
// TODO: Skipping until EXAMPLE-123 is completed
describe.skip("test", () => {}); |
Oh yes, sorry I misread your request. I think this would be better served by a dedicated rule |
lint/noExclusiveTests
- eslint-plugin-jest/no-focused-tests
, eslint-plugin-mocha/no-exclusive-tests
lint/noExclusiveTests
- eslint-plugin-jest/no-focused-tests
, eslint-plugin-mocha/no-exclusive-tests
, eslint-plugin-no-only-tests
I'd like to work on this issue 🙏 |
Description
Implement no-focused-tests / no-exclusive-tests / no-only-test.
I think we could restrict the rule to
test.only
,describe.only
andit.only
.Want to contribute? Lets you know you are interested! We will assign you to the issue to prevent several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! Read our contributing guide and analyzer contributing guide.
This was proposed by @emab.
The text was updated successfully, but these errors were encountered: