-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
react-scripts test is watching files in node_modules #2393
Comments
Side note: The error does not appear in |
I am not exactly sure what the corresponding jest config is, maybe My test about |
Thanks for creating the example source @thisconnect - I have a PR #2395 that should fix this issue. Although the underlining issue is with Jest, and will depend if the maintainers of CRA would prefer to wait for Jest to fix, or fix it here until it's fixed in Jest. |
How hard is it to fix in Jest? |
I am really unsure. As mentioned in jestjs/jest/issues/1767 when Jest is using the node_watcher it is tells it to watch everything with chosen extensions, rather than just the files in Its possible the fix is just to pass Hopefully @cpojer or @pugnascotia will have a better answer. |
@ro-savage fyi, if Jest only watches the files matching testMatch, that means that we won't be able to run tests when non-test files change. So that is the expected behavior. |
@cpojer - Of course, it didn't even click that it was only matching the test files. Then it should be fine to use both (I understand there might be edge cases where you |
This might help fix the crashes: amasad/sane#97. |
New sane version works for me amasad/sane#97 (comment) |
Jest merged sane in jestjs/jest#3918 |
Reinstalling watchman fixed this error for me. brew uninstall watchman |
[email protected] should have the fixed |
I did a Apparently you need watchman installed. |
We updated to Jest 22 on the |
thanks @gaearon !!! |
No, we don’t support installation from GitHub. When it’s available, you will be able to just specify the version we release. |
ok, thanks |
@gaearon just FYI I am testing Had a minor issue running I am sorry for commenting on this closed issue, just wanted to report and say thanks. Thanks! |
Can you reproduce the problem with latest npm?
yes
Can you still reproduce it?
yes, also did
npm cache clean
just to be sureDescription
This is a followup of "npm test hangs for newly generated app (#960)". After reading the comment of @hmeerlo that "Jest is trying to watch too many files at once (jestjs/jest#1767 (comment))" I suspect that files in node_modules are unnecessarily being watched.
Expected behavior
npm t
should run without error.Actual behavior
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected): [email protected]node -v
: v6.10.3npm -v
: 4.6.1Then, specify:
watchman
never installedReproducible Demo
https://github.com/thisconnect/cra-desktop
Reproduce the error
This is an instantiated create-react-app (un-ejected) with
electron
added as described in PR #1718Without error (when removing 2 large dependencies)
Assuming
react-scripts test
is indeed watching files in node_modules, removeelectron
andelectron-packager
from devDependencies in package.json, thenrm -rf node_modules && npm i && npm t
, test mode runs fine. This does not yet prove that files in node_modules are being watched.Strong indication that node_modules is being watched:
// test
Terminal before changing a random file in node_modules (screenshot 1)
Terminal after chaning a random file in node_modules (screenshot 2)
The text was updated successfully, but these errors were encountered: