question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: (0 , _vm(...).compileFunction) is not a function

See original GitHub issue

🐛 Bug Report

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

To Reproduce

Steps to reproduce the behavior:

  1. Clone this repo: https://github.com/inorganik/debugout.js/tree/typescript
  2. Make sure you ave the branch typescript checked out
  3. Run npm i then npm t

Expected behavior

Tests should run

Link to repo (highly encouraged)

https://github.com/inorganik/debugout.js

Debug log:

{"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"}

envinfo

System:
    OS: macOS

Npm packages:
    jest: 26.1.0
    ts-jest: 26.1.1
    typescript: 3.9.5
    babel(optional):

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
inorganikcommented, Jun 26, 2020

Updating to node v12 fixed it 👍

0reactions
ahnpnlcommented, Jun 26, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: (0 , .....) is not a function - javascript - Stack Overflow
To create a theme you want to use createMuiTheme (https://material-ui.com/customization/theming/) const theme = createMuiTheme({ palette: ...
Read more >
VM (executing JavaScript) | Node.js v19.3.0 Documentation
The node:vm module enables compiling and running code within V8 Virtual Machine contexts. The node:vm module is not a security mechanism. Do not...
Read more >
VM (executing JavaScript)
The vm module enables compiling and running code within V8 Virtual Machine contexts. The vm module is not a security mechanism.
Read more >
qawolf/community - Gitter
TypeError : (0 , _vm(...).compileFunction) is not a function at Runtime._execModule (../node_modules/jest-runtime/build/index.js:1166:56)" it seems that is ...
Read more >
How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found