{"action":"created","issue":{"url":"https://api.github.com/repos/facebookincubator/create-react-app/issues/2393","repository_url":"https://api.github.com/repos/facebookincubator/create-react-app","labels_url":"https://api.github.com/repos/facebookincubator/create-react-app/issues/2393/labels{/name}","comments_url":"https://api.github.com/repos/facebookincubator/create-react-app/issues/2393/comments","events_url":"https://api.github.com/repos/facebookincubator/create-react-app/issues/2393/events","html_url":"https://github.com/facebookincubator/create-react-app/issues/2393","id":231854365,"number":2393,"title":"react-scripts test is watching files in node_modules","user":{"login":"thisconnect","id":546900,"avatar_url":"https://avatars0.githubusercontent.com/u/546900?v=3","gravatar_id":"","url":"https://api.github.com/users/thisconnect","html_url":"https://github.com/thisconnect","followers_url":"https://api.github.com/users/thisconnect/followers","following_url":"https://api.github.com/users/thisconnect/following{/other_user}","gists_url":"https://api.github.com/users/thisconnect/gists{/gist_id}","starred_url":"https://api.github.com/users/thisconnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisconnect/subscriptions","organizations_url":"https://api.github.com/users/thisconnect/orgs","repos_url":"https://api.github.com/users/thisconnect/repos","events_url":"https://api.github.com/users/thisconnect/events{/privacy}","received_events_url":"https://api.github.com/users/thisconnect/received_events","type":"User","site_admin":false},"labels":[{"id":409578974,"url":"https://api.github.com/repos/facebookincubator/create-react-app/labels/issue:%20bug","name":"issue: bug","color":"ee0701","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-05-28T08:18:12Z","updated_at":"2017-05-28T10:19:19Z","closed_at":null,"body":"### Can you reproduce the problem with latest npm?\r\n\r\nyes\r\n\r\nCan you still reproduce it?\r\n\r\nyes, also did `npm cache clean` just to be sure\r\n\r\n### Description\r\n\r\nThis 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 (https://github.com/facebook/jest/issues/1767#issuecomment-250719565)\" I suspect that files in node_modules are unnecessarily being watched.\r\n\r\n\r\n### Expected behavior\r\n\r\n`npm t` should run without error.\r\n\r\n### Actual behavior\r\n\r\n```\r\nreact-scripts test --env=jsdom\r\n\r\n2017-05-28 09:18 node[1154] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)\r\n2017-05-28 09:18 node[1154] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)\r\nevents.js:160\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\n\r\nError: Error watching file for changes: EMFILE\r\n    at exports._errnoException (util.js:1018:11)\r\n    at FSEvent.FSWatcher._handle.onchange (fs.js:1420:11)\r\nnpm ERR! Test failed.  See above for more details.\r\n```\r\n\r\n### Environment\r\n\r\nRun these commands in the project folder and fill in their results:\r\n\r\n1. `npm ls react-scripts` (if you haven’t ejected): react-scripts@1.0.7\r\n2. `node -v`: v6.10.3\r\n3. `npm -v`: 4.6.1\r\n\r\nThen, specify:\r\n\r\n1. Operating system: macOS Sierra 10.12.5\r\n2. Browser and version: -\r\n3. `watchman` never installed\r\n\r\n### Reproducible Demo\r\n\r\nhttps://github.com/thisconnect/cra-desktop\r\n\r\n#### Reproduce the error\r\nThis is an instantiated create-react-app (un-ejected) with `electron` added as described in PR https://github.com/facebookincubator/create-react-app/pull/1718\r\n```\r\ngit clone https://github.com/thisconnect/cra-desktop\r\ncd cra-desktop\r\nnpm install\r\nnpm test\r\n```\r\n\r\n#### Without error (when removing 2 large dependencies)\r\nAssuming `react-scripts test` is indeed watching files in node_modules, remove `electron` and `electron-packager` from devDependencies in package.json, then `rm -rf node_modules && npm i && npm t`, test mode runs fine. This does not yet prove that files in node_modules are being watched.\r\n\r\nStrong indication that node_modules is being watched:\r\n- run any CRA instance without error\r\n- the Terminal should display something like \"No tests found related to files changed since last commit\" and the \"Watch Usage\"\r\n- open a random .js file in node_modules\r\n- for example node_modules/mime/mime.js\r\n- watch the Terminal (screenshot 1)\r\n- add a comment on any line i.e. `// test`\r\n- save the file\r\n- check if the terminal changed (screenshot 2)\r\n\r\nTerminal before changing a random file in node_modules (screenshot 1)\r\n![screen shot 2017-05-28 at 9 56 55 am](https://cloud.githubusercontent.com/assets/546900/26527174/2eb74150-438e-11e7-949b-4a55b23f5614.png)\r\n\r\nTerminal after chaning a random file in node_modules (screenshot 2)\r\n![screen shot 2017-05-28 at 10 04 40 am](https://cloud.githubusercontent.com/assets/546900/26527178/41291566-438e-11e7-83b0-6a569557916f.png)\r\n"},"comment":{"url":"https://api.github.com/repos/facebookincubator/create-react-app/issues/comments/304504972","html_url":"https://github.com/facebookincubator/create-react-app/issues/2393#issuecomment-304504972","issue_url":"https://api.github.com/repos/facebookincubator/create-react-app/issues/2393","id":304504972,"user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars3.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"created_at":"2017-05-28T10:19:19Z","updated_at":"2017-05-28T10:19:19Z","body":"How hard is it to fix in Jest?"}}
{"actor":{"display_login":"gaearon"}}