2
votes

So I am trying to switch from Karma to Jest. I cant seem to get Jest to run on my windows machine. I have it working for the mac though.

I followed: https://www.xfive.co/blog/testing-angular-faster-jest/

Here's what I am seeing: (it just sits here) enter image description here

My package.json has this as the jest config:

"jest": { "preset": "jest-preset-angular", "setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts", "globals": { "__TS_CONFIG__": "tsconfig.json" }, "testRegex": "(/src/.*|(\\.|/))\\.spec\\.ts?$" }

Like I said, I can get this to work for the mac, but for windows it is not working, just sits at the above image.. Any ideas?

1
can we see your setupJest.ts file? and if by any chance you can create a repo on github with what you have so far this could help - j3ff
Did you solve this? - IntoTheDeep

1 Answers

0
votes

For me the reason is some kind of incompatibility when running Windows console applications from BASH. To verify, just run your npm scripts through Window's native command prompt.

You can utilize winpty to run Windows console applications through Git BASH. In my case I have to enter the full path to the program to run and use npm.cmd, even through Git BASH. In my case however, the Node installatin is NOT in the global PATH. So from Git BASH, run:

winpty <BASH-compatible path to Node installation>/npm.cmd test