node -v: [8.9.0]npm -v: [5.4.2]
Operating system: [macOS v10.12.5]
Install Jest extension
Restart VS Code
Jest extension runs without error
Jest extension errors after multiple attempts at running
Task bar says "Jest: stopped (too many restarts)
Jest OUTPUT

Error in console

Package.json scripts:
"scripts": {
"start": "concurrently --kill-others \"better-npm-run start-prod\" \"npm run start-api\"",
"test": "jest",
"updateSnapshots": "jest --updateSnapshot",
"test-watch": "jest --watch",
},
Let me know if you need any further info
Thanks,
Owen
What version of Jest do you have? Run npm ls jest
Is it possible to try and reproduce this issue on a different OS?
From what I can gather, this is an issue with the way Jest handles file watching when watchman hasn't been installed, and there have been Mac-specific issues. There is an issue in the create-react-app project that suggests that Jest 21 should fix the problem, and can be tracked by this issue in the jest repo.
@seanpoulter thanks for the reply, I've upgraded to v21.x.x now and it works the first time. Whenever I have a failing test however, and then re-save having fixed the test, it doesn't mark it as 'passing'
If the tests aren't updating, are there any hints why in the Jest Output Panel?
My hunch is that Jest runs once then starts in watch mode where it defaults to only watching files that have changed based on the status from a git/hg repository (-o/--onlyChanged). If you haven't set up version control, then you'll end up with a vague error message in the Jest output about -o. Your options are to set up Jest to watch all files (--watchAll).
Here's what that looks like on my end:
Jest: Show Test Output Channel
I've been receiving similar message from Jest.
Jest addon does run the initial test successfully, however fails when trying to start the watch mode.
Watch mode works fine if I run it manually from terminal.
Here's my jest.config.js:
module.exports = {
"name": "json-proxy",
"verbose": true,
"testRegex": "/test/.*\\.spec\\.(ts|tsx|js)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"transform": {
"\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
}
};
Here's the content of the debug pannel:
events.js:160
throw er; // Unhandled 'error' event
^
Error: UNKNOWN: unknown error, lstat 'c:\Users\Nikola\Documents\web-projects\json-proxy\node_modules\.bin\_mocha'
at Error (native)
Closed Jest
Jest exited unexpectedly, restarting watch mode
Closed Jest
events.js:160
throw er; // Unhandled 'error' event
^
Error: UNKNOWN: unknown error, lstat 'c:\Users\Nikola\Documents\web-projects\json-proxy\node_modules\.bin\atob'
at Error (native)
Closed Jest
Jest exited unexpectedly, restarting watch mode
Closed Jest
events.js:160
throw er; // Unhandled 'error' event
^
Error: UNKNOWN: unknown error, lstat 'c:\Users\Nikola\Documents\web-projects\json-proxy\node_modules\.bin\atob'
at Error (native)
Closed Jest
Jest exited unexpectedly, restarting watch mode
Closed Jest
events.js:160
throw er; // Unhandled 'error' event
^
Error: UNKNOWN: unknown error, lstat 'c:\Users\Nikola\Documents\web-projects\json-proxy\node_modules\.bin\_mocha'
at Error (native)
Closed Jest
Closed Jest
Here's the content of the Chrome Dev-tools console:
jest:2 Uncaught SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Timeout.Module.runMain [as _onTimeout] (module.js:604:10)
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
createScript @ vm.js:56
runInThisContext @ vm.js:97
Module._compile @ module.js:542
Module._extensions..js @ module.js:579
Module.load @ module.js:487
tryModuleLoad @ module.js:446
Module._load @ module.js:438
Module.runMain @ module.js:604
ontimeout @ timers.js:386
tryOnTimeout @ timers.js:250
listOnTimeout @ timers.js:214
Have you had any luck figuring out the cause @knee-cola? If not, do you have a test case we can use to reproduce the issue?
While trying to create a test-case I managed to figure it out (@seanpoulter thanks for your question)!
The problem was caused by me installing ts-jest via bash terminal (WLS) instead of using CMD Terminal. As the result it's dependency cpx was not compiled correctly - there was no cpx.cmd' inside thenode_modules/.bin/` directory.
I managed to fix the problem by deleting the node_modules directory and doing npm install from CMD/DOS terminal. That re-installed and compiled correctly all the modules.
It's probably safest option to always install all the modules from CMD/DOS terminal. That way they will work both in in bash and cmd terminal!
I also have this issue and also use ts-jest, but I think (pretty sure) I installed it thru the dos/cmd prompt...
Any tips what I can look for to solve this (I'm a newbie - first ts/jest project).
Thanx.
Well I'm bi longer sure that installing things from CMD helped. Later I cloned my repo onto another machine and everything worked fine.
Could you debug the extension with your ts-jest project @obiwanjacobi, or provide a minimal repo we can try?
Installing watchman fixed this issue for me:
brew update
brew install watchman
Then reload the Jest plugin
Most helpful comment
Installing watchman fixed this issue for me:
brew updatebrew install watchmanThen reload the Jest plugin