-
-
Notifications
You must be signed in to change notification settings - Fork 443
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
oxlint: jest-plugin: no-export: false positives for exports in __mocks__ files #2397
Comments
Thanks for your using! we treated it as a test file if it imports global variables like |
By default, jest uses these lists of globs to find test files:
But, by default, it will first search for a I'm not sure how much complexity is desirable in this area, but perhaps we could start with the equivalent of those hard-coded globs? Would you accept a PR that also checks for a static jest.config.json file? |
We can start with a hard-coded glob first, PR is always welcome! Do we need to check static jest config? @Boshen |
Let's try and not to read another config file. Are there any workarounds? For example ignore the rule by using https://eslint.org/docs/latest/use/configure/ignore#ignorepatterns-in-config-files? |
Thanks so much for sharing this exciting project!
I have a project that uses the manual mocks feature for jest: https://jestjs.io/docs/manual-mocks
e.g.
export do() => { /* ... */ }
)export do() -> jest.fn().mockImplementation(() => { /* ... */ })
)import './other.js'
)jest.mock('./other.js')
)It's expected that these jest manual mock files
export
just like the production files that they mirroroxlint --jest-plugin
(version 0.2.8) results in "⚠ eslint-plugin-jest(no-export): Do not export from a test file." when scanning __mocks__/other.js , so it seems to consider these manual mock files to be test files, but I think it should not classify them as test filesThe text was updated successfully, but these errors were encountered: