Hello,
Extension shows error at output:

pure node --harmony project, no babel anywhere, npm test = node --harmony node_modules/.bin/jest
Hrm, that's worrying, that's coming Jest directly - could you not have watchman installed?
@orta yep, installing watchman solves that! I didn't realise it's a dependency, that's nowhere mentioned... Thank you!
馃憤 interesting, I would have thought watchman was an optional dep
Have also come across this issue. Care to explain what's causing it? Not familiar with watchman...
@tinovyatkin & @orta, remember what's up with this one?
watchman is what powers the jest file watcher, it's not optional - https://github.com/facebook/watchman
Someone could send a PR that adds a verification for it being installed
I see a similar error (but not exactly the same). When run in vscode with this extension, the tests run (and pass), and then it fails to enter watch mode with
2019-08-08 16:32 node[24048] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24048] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24048] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:123:28)
2019-08-08 16:32 node[24051] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24051] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24051] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:123:28)
2019-08-08 16:32 node[24054] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24054] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24054] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:123:28)
2019-08-08 16:32 node[24057] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24057] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24057] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:123:28)
2019-08-08 16:32 node[24060] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24060] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-08-08 16:32 node[24060] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:123:28)
Starting Jest in Watch mode failed too many times and has been stopped.
see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting
I did not have watchman installed at first (although i did have fb-watchman, which seems to have replaced watchman for newer versions of jest). Installing watchman and restarting everything did not help.
I used the debug option to log the command being run, it's yarn test --testLocationInResults --json --useStderr --watch --no-color. I can run this in a terminal with no problem (both a standalone terminal and vscode's built-in terminal).
Everything used to work in this repo with the vscode extension; the problems started when I deleted my node_modules directory and reinstalled everything. No idea what might have changed there.
FWIW, if I set "path to jest" to yarn test -- --no-watchman it works (including watch mode).
Looks like I've solved this for myself, for now, after reading many of the conflicting reports that watchman or fb-watchman being installed, or not installed I've not touched any of that for fear of perpetuating that side of things.
Anyways, I had tried removing node_modules and reinstalling, that worked once or twice, I restarted the Finder app, because, open files, again this issue kept reappearing
Next I thought that Jest was trying to watch all the files in /node_modules, wondering if like much of these tools they will inherit the _ignore_ path from the .gitignore, went looking at the docs and no mention of Jest doing that.
Side Note: I believe testPathIgnorePatterns ignores /node_modules by default
Thus I tried adding /node_modules to watchPathIgnorePatterns
Yup, this now works for me, consistently, with this not set Jest fails to start in watch mode, setting this Jest will start and restart in _watch_ mode successfully
"jest": {
"watchPathIgnorePatterns": [
"/node_modules/"
]
}
The above is in my package.json file, I'll try updating it in some Jest config files and shared configs a bit later
There's a few Jest issues that state the above works as a workaround but not the ideal solution, it was supposedly fixed in Jest 24.8.0, but not for everyone and the above workaround is still required
So whilst the above works, the consensus appears to be that this is not the "right" solution, if you've complex projects this wouldn't be ideal, so for now, this will work for me and I'll keep an eye on the above linked Jest issue
The easiest thing would be to install Watchman:
$ brew update
$ brew install watchman
If you don't have brew, do this first:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Most helpful comment
Looks like I've solved this for myself, for now, after reading many of the conflicting reports that
watchmanorfb-watchmanbeing installed, or not installed I've not touched any of that for fear of perpetuating that side of things.Anyways, I had tried removing
node_modulesand reinstalling, that worked once or twice, I restarted the Finder app, because, open files, again this issue kept reappearingNext I thought that Jest was trying to watch all the files in
/node_modules, wondering if like much of these tools they will inherit the _ignore_ path from the.gitignore, went looking at the docs and no mention of Jest doing that.Side Note: I believe
testPathIgnorePatternsignores/node_modulesby defaultThus I tried adding
/node_modulestowatchPathIgnorePatternsYup, this now works for me, consistently, with this not set Jest fails to start in watch mode, setting this Jest will start and restart in _watch_ mode successfully
The above is in my
package.jsonfile, I'll try updating it in some Jest config files and shared configs a bit laterThere's a few Jest issues that state the above works as a workaround but not the ideal solution, it was supposedly fixed in Jest 24.8.0, but not for everyone and the above workaround is still required
So whilst the above works, the consensus appears to be that this is not the "right" solution, if you've complex projects this wouldn't be ideal, so for now, this will work for me and I'll keep an eye on the above linked Jest issue