-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Ability to add folders to have jest ignore #1299
Comments
We're facing this with a Cordova app where Jest is trying to run tests in the plugins folder so a solution to this would be welcome: even if it means using a custom script (but not if it means ejecting!) Can you share your custom script please chrisdrackett? |
for now we've just used https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/scripts/test.js practically verbatim. |
I have a
|
Are there not CLI flags your can pass to npm test to handle this? ARGS after npm test -- ... are passed to jest. There's also a custom config file you can use, https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/utils/createJestConfig.js#L18 |
Closing as a duplicate of #544. |
While this issue was based upon ignoring a folder outside Because of that use case, I think it is relevant to the original request of this issue, to have the ability to add folders (and files) to have Jest ignore, and subsequently I don't think that this is necessarily a duplicate of #544. I would still like to see some sort of ignore/exclude functionality that applies not only to files/folders outside |
Can you explain more about your use case? The comment about submodules mentioned they're outside |
Actually, my use case is better exemplified by #1455, so I'll defer to that issue instead of continuing discussion in this one. |
@gaearon It'd be great to be able to exclude files from jest. E.g., if I have some test lib with functions commonly used by differennt tests, I can't put it in the |
We are only running tests inside I'm not sure what you mean by your question though. A specific example would help. |
|
Right, but why do you need to put |
@gaearon how would you go about handling submodules within the src file? Our use case is that the submodule runs tests in a different testEnvironment than the main React app (node instead of jsdom because we've encountered some issues with request headers in the jsdom environment). We're using old react-scripts 0.9.5 right now, which uses an older version of Jest that does not support specifying different testEnvironments seen here I'm completely open to moving the submodule outside of the src and then excluding it from the coverage report as mentioned in #1455, if thats the case, what would be the CRA recommended folder for that? |
Hi i'm having a similar issue, I have fakers inside the Right now I'm planning on solving this by moving them outside the An easy approach could be ignoring files with a particular key. Like Thanks a lot! |
We currently have a couple of submodules that are outside of the src directory that we would like jest to ignore. The only way we've found to do this currently is to replace the test script with one of our own. While this isn't a big deal, it would be nice to be able to ignore these directories within our
package.json
The text was updated successfully, but these errors were encountered: