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.

Babel transformation error: "don't know how to turn this value into a node"

See original GitHub issue

Bug Report

After upgrading webpack and babel I’m now faced with a few errors like this from our vue-jest based test suite, and I have no idea how to go about debugging them:

/home/rof/src/github.com/hubbado/hubbado_core/app/javascript/general-stats/views/GeneralStats/Controls.vue: don't know how to turn this value into a node

Current behavior

This is the only type of stacktrace I get, on around 8 or so tests:

 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)

Input Code

Apologies, I’m not sure what code will be useful to share here.- I’m open to suggestions. Our test suite is currently using vue-jest

Expected behavior Files continue to be transformed correctly in the test suite

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: babel.config.js
module.exports = function(api) {
  var validEnv = ['development', 'test', 'production']
  var currentEnv = api.env()
  var isDevelopmentEnv = api.env('development')
  var isProductionEnv = api.env('production')
  var isTestEnv = api.env('test')

  if (!validEnv.includes(currentEnv)) {
    throw new Error(
      'Please specify a valid `NODE_ENV` or ' +
        '`BABEL_ENV` environment variables. Valid values are "development", ' +
        '"test", and "production". Instead, received: ' +
        JSON.stringify(currentEnv) +
        '.'
    )
  }

  return {
    presets: [
      isTestEnv && [
        require('@babel/preset-env').default,
        {
          targets: {
            node: 'current'
          }
        }
      ],
      (isProductionEnv || isDevelopmentEnv) && [
        require('@babel/preset-env').default,
        {
          forceAllTransforms: true,
          useBuiltIns: 'entry',
          corejs: 3,
          modules: false,
          exclude: ['transform-typeof-symbol']
        }
      ]
    ].filter(Boolean),
    plugins: [
      require('babel-plugin-macros'),
      require('@babel/plugin-syntax-dynamic-import').default,
      isTestEnv && require('babel-plugin-dynamic-import-node'),
      require('@babel/plugin-transform-destructuring').default,
      [
        require('@babel/plugin-proposal-class-properties').default,
        {
          loose: true
        }
      ],
      [
        require('@babel/plugin-proposal-object-rest-spread').default,
        {
          useBuiltIns: true
        }
      ],
      [
        require('@babel/plugin-transform-runtime').default,
        {
          helpers: false,
          regenerator: true,
          corejs: false
        }
      ],
      [
        require('@babel/plugin-transform-regenerator').default,
        {
          async: false
        }
      ]
    ].filter(Boolean)
  }
}

Environment

npx: installed 1 in 1.922s

  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
  • How you are using Babel: loader (via webpacker)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:22 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
samsticklandcommented, Sep 15, 2020

This is now fixed in vue-jest@4.0.0-rc.0. Please see https://github.com/facebook/jest/issues/10089#issuecomment-692390820

1reaction
JLHwungcommented, Sep 15, 2020

Closing this as the downstream issue is fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error: "don't know how to turn this value into a node ... - GitHub
Bug Report After upgrading babel I get the following errors on some of test suite when code coverage is enabled: FAIL ...
Read more >
BabelJS error "don't know how to turn this value into a node"
After upgrading webpack and babel I'm now faced with a few errors like this from our vue-jest based test suite, and I have...
Read more >
Nuxt.js & Vue.js jest returns error: “don't know how to turn this ...
And stacktrace is pointing to babel as one of the causes too according to: Babel transformation error: "don't know how to turn this...
Read more >
babel/polyfill
It is automatically loaded when using @babel/preset-env 's useBuiltIns: "usage" option or @babel/plugin-transform-runtime . Babel includes a polyfill that ...
Read more >
babel-loader - webpack
js$/ , you might be transforming the node_modules folder or other unwanted source. To exclude node_modules , see the exclude option in the...
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