I have a super-simple typescript project I am trying to test. I setup jest following the readme instructions, and am only trying to test 1 typescript class. However, upon running npm t, I get:
> jest
FAIL src/debugout.spec.ts
● Test suite failed to run
TypeError: (0 , _vm(...).compileFunction) is not a function
at Runtime._execModule (node_modules/jest-runtime/build/index.js:1179:56)
Test Suites: 1 failed, 1 total
Steps to reproduce the behavior:
typescript checked outnpm i then npm tTests should run
https://github.com/inorganik/debugout.js
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"26.1.1"},"message":"creating jest presets not handling JavaScript files","sequence":1,"time":"2020-06-26T16:10:03.257Z"}
System:
OS: macOS
Npm packages:
jest: 26.1.0
ts-jest: 26.1.1
typescript: 3.9.5
babel(optional):
I have cloned your repo on my Mac and I couldn't reproduce the issue.

I think there is a problem with your Mac. Did you run the test in a specific environment ?
A problem with my mac? Hmm.... I rolled jest and ts-jest back to v24 and it works, so it appears to be a problem introduced in a recent version of jest or ts-jest...
I don't believe the module type in tsconfig is the problem, as I have another repo with the same tsconfig and it tests just fine (also on v24 of both jest and ts-jest)
As you can above with WebStorm, I couldn't reproduce the issue. I saw this one somewhere in jest repo before. Not sure how to help in this case because I cannot reproduce the issue.
@ahnpnl which version of node are you at? I have v10.9.0
Oh I am using node 12, maybe you should use node 10.21.0 or higher. I think maybe jest doesn't support node 10.9
Updating to node v12 fixed it 👍
Most helpful comment
Updating to node v12 fixed it 👍