no-disabled-tests doesn't recognice spreading
See original GitHub issueWe have defined a couple of tests that we run for a lot of components we build. Those tests get auto generated by a method and the return value gets spreaded into the test method. Unfortunatly the rule no-disabled-tests
can not resolve the spreading and therefore throws an error ( Test is missing function argument eslint(jest/no-disabled-tests)
).
minimal example:
const test = [
"title",
() => { expect(true).toBe(true); },
];
describe("@components/someComponent", () => {
it(...test); // warning Disabled test suite jest/no-disabled-tests
})
a more practial example would be this:
import PulsatingDot from "./PulsatingDot";
describe("@components/atoms/PulsatingDot", () => {
// isValidComponent returns
// ["PulsatingDot exports a valid component", () => { ... }]
it(...isValidComponent(PulsatingDot));
});
Is there an easy way to fix this on our side or is the rule just not compatible with this approach?
Research I did:
- The error seems to be coming from here and is thrown because the spreading isn’t detected as multiple arguments. Maybe there is another method to check the number of parameters?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
eslint-plugin-jest/no-disabled-tests.md at main - GitHub
Before committing changes we may want to check that all tests are running. This rule raises a warning about disabled tests.
Read more >Is there a way to ignore test files for eslint-plugin-security?
The best way I found to deal with this case is based on this answer. You can override parts of your eslint file...
Read more >Covid-19 testing: Here's why you can be contagious but still ...
Don't get a false sense of security with Covid-19 testing. Here's why you can test negative but still be infected and contagious.
Read more >Coronavirus FAQ: Testing confuses me! When to do it ... - NPR
With COVID case counts falling and rising, testing is critical. But how many days after exposure should I test? And if I have...
Read more >What you should know about rapid antigen tests - PBS
So what can Americans be doing now to slow or limit the spread of ... It doesn't tell us whether we're contagious or...
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
I’m going to close this at
wontfix
as I don’t think it’s a pattern we want to encourage.You could easily work around this by changing
isValidComponent
to contain theit
:IMO this is better anyway as it encapsulates the responsibility of the function.
@G-Rath Yes kindof. We have a global function called
isValidComponent
which will receive a Component as a parameter and uses this component to generate and return an Array that includes the testname with the populated component name as the first entry and a test function populated with the component to test as the second parameter.