You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once a file has a function named "test" declared and been called in the file, the file will be marked as a test file and this makes it work wrong with the rule "jest/no-export".
The text was updated successfully, but these errors were encountered:
374632897
changed the title
The rule "Do not export from a test file (jest/no-export)" works wrong with some situations.
The utility function "isTestCase" works wrong with some situations.
May 20, 2020
This behaviour is correct: any file that is linted by eslint-plugin-jest is assumed to be a test file, as that is the kind of files this plugin is designed to lint.
We do have plans to improve our checking for the jest globals, which would most likely result in this particular case no longer being flagged, but regardless you should use overrides property in your eslint config to apply the rules from this plugin to just your test files :)
The relative PR is #307 .
See the test case like below(referenced from no-export.test.ts):
The last item of valid array declares a function named "test" and exports it. In this case, the utility function "isTestCase" makes a wrong check:
Once a file has a function named "test" declared and been called in the file, the file will be marked as a test file and this makes it work wrong with the rule "jest/no-export".
The text was updated successfully, but these errors were encountered: