False-positive jest/no-disabled-tests
See original GitHub issueIn a non-test file (trackingXiti.ts), I have a function like this:
const mapPageViewEventName = (...) => {
....
const map = xitiViewMap(...)
...
}
The rule warns about the line with the xitiViewMap
function, probably because it starts with xit
.
- Shouldn’t the jest rules only run on
*.test.{js,tsx?}
files? - The rule should match
xit(
and notxitSomethingElse(
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
eslint-plugin-jest/no-disabled-tests.md at main
This rule raises a warning about disabled tests. Rule details. There are a number of ways to disable tests in Jest: by appending...
Read more >How to Test Asynchronous Code with Jest
If you want to avoid Jest giving a false positive, by running tests without assertions, you can either use the expect.hasAssertions() or expect....
Read more >Jest CLI Options
Run only the tests that were specified with a pattern or filename: ... jest path/to/my-test.js ... Disable the cache using --no-cache .
Read more >5 tips for a healthier DivOps setup
In my opinion, a codebase with false-positive tests or tests that ... from accidentally committing skipped tests ( jest/no-disabled-tests ).
Read more >@testing-library/jest-dom - npm
Note: We also recommend installing the jest-dom eslint plugin which provides auto-fixable lint rules that prevent false positive tests and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s what exactly
overrides
is for 😃Here’s one of my projects that uses
overrides
to apply theeslint-plugin-jest
rules only to test files (via applying my company’sjest
shared config).We do hope to read the config one day to enhance the rules - see here for why that’s currently not possible.
However, I don’t think we’d do that for determining what files to run on, as that is exactly what you’re meant to be using
overrides
for and some of our rules don’t require being rule on files that jest runs as tests (i.e test helpers).