jest: error: "don't know how to turn this value into a node" when using code coverage

πŸ› 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```

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 15 (1 by maintainers)

Commits related to this issue

Most upvoted comments

I got it!

@jest/transform creates inline source-map since 25.5.0(#9811). But vue-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 is don't know how to turn this value into a node.

I must be being dense - can you explain where the simularity is?