error: "don't know how to turn this value into a node" when using code coverage
See original GitHub issue🐛 Bug Report
After upgrading babel I get the following errors on some of test suite when code coverage is enabled:
FAIL spec/javascript/general-stats/GeneralStats.spec.js
● Test suite failed to run
/Users/samuelstickland/development/hubbado/hubbado_core/app/javascript/general-stats/views/GeneralStats.vue: don't know how to turn this value into a node
at valueToNode (node_modules/@babel/types/lib/converters/valueToNode.js:87:9)
at Object.valueToNode (node_modules/@babel/types/lib/converters/valueToNode.js:81:58)
at Object.exit (node_modules/istanbul-lib-instrument/dist/visitor.js:641:30)
at PluginPass.exit (node_modules/babel-plugin-istanbul/lib/index.js:158:38)
at newFn (node_modules/@babel/traverse/lib/visitors.js:179:21)
at NodePath._call (node_modules/@babel/traverse/lib/path/context.js:55:20)
at NodePath.call (node_modules/@babel/traverse/lib/path/context.js:42:17)
at NodePath.visit (node_modules/@babel/traverse/lib/path/context.js:99:8)
at TraversalContext.visitQueue (node_modules/@babel/traverse/lib/context.js:112:16)
at TraversalContext.visitSingle (node_modules/@babel/traverse/lib/context.js:84:19)
at TraversalContext.visit (node_modules/@babel/traverse/lib/context.js:140:19)
at Function.traverse.node (node_modules/@babel/traverse/lib/index.js:84:17)
at traverse (node_modules/@babel/traverse/lib/index.js:66:12)
at transformFile (node_modules/@babel/core/lib/transformation/index.js:107:29)
at transformFile.next (<anonymous>)
at run (node_modules/@babel/core/lib/transformation/index.js:35:12)
To Reproduce
Enable code coverage in jest.config.json
and run the test suite via yarn test
"collectCoverage": true,
"collectCoverageFrom": [
"<rootDir>/app/javascript/**/*.{js,vue}",
"!<rootDir>/app/javascript/packs/*"
]
Expected behavior
Test suite runs correctly and code coverage is collected.
Link to repl or repo (highly encouraged)
This is a private repo. If there isn’t enough information in the stack trace I can try and make a cutdown version I can make public
envinfo
System:
OS: macOS 10.15.4
Binaries:
Node: 14.3.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
npmPackages:
@babel/core: >=7.0.0 => 7.9.6
babel-jest: >=26.0.0 => 26.0.1
babel-loader: >=8.0.6 => 8.1.0
babel-preset: >=1.0.15 => 1.1.4
jest: >=26.0.0 => 26.0.1```
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:15 (1 by maintainers)
Top Results From Across the Web
How do I resolve the error "don't know how to turn this value ...
The resolve is to use istanbul in the babel config (as given in Cypress docs). The cause isn't apparent, without <script setup> the...
Read more >Nuxt.js & Vue.js jest returns error: “don't know how to turn this ...
js jest returns error: “don't know how to turn this value into a node”. Problem: Are you getting a similar error to the...
Read more >Troubleshooting Code Coverage - Visual Studio (Windows)
Analysis—Check your output window. In the Show Output from drop-down list, choose Tests. See if there are any warnings or errors logged.
Read more >Code Coverage - Cypress Documentation
Let's look at the one file that has a "missed" line. It is the src/selectors/index.js file shown below. ... The source line not...
Read more >Mocha - the fun, simple, flexible JavaScript test framework
Mocha is a feature-rich JavaScript test framework running on Node.js and in the ... If you use callback-based async tests, Mocha will throw...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got it!
@jest/transform
creates inline source-map since 25.5.0(#9811). Butvue-jest@v4.0.0-beta
already adds it with process(). So reporter throws error due to duplicate source maps.Fixed in vuejs/vue-jest#255
@kjugi I’m confused. It looks to me like the error in the two issues you posted is
Cannot find module '@babel/compat-data/corejs3-shipped-proposals'
but mine isdon't know how to turn this value into a node
.I must be being dense - can you explain where the simularity is?