Nuxt.js & Vue.js jest returns error: “don’t know how to turn this value into a node”

Problem: Are you getting a similar error to the following output?

According to:

Problem is stemming from conflicts from vue-jest@latest and it’s compatibility with jest@latest.

jest V25 and v26 is not compatible with vue-jest v4 or v5 currently. And stacktrace is pointing to babel as one of the causes too according to:

So what can we do about it for now?

Solution 1: Wait for the latest npm package conflicts to resolve

Wait for the vue-jest team to update their package to work with latest jest package.

Solution 2: Downgrade jest and vue-jest npm packages to these specific versions. (Temporary Recommended Solution)

  1. Downgrade vue-jest and jest versions. This is temporary solution until vue-jest is compatible with the latest jest npm package.

2. Ensure your jest.config.js file is mapping correctly to your tests and folders and it should run smoothly like before.

3. Be sure to check back to the github page for `vue-jest` to see if a new package is working with latest jest versions.

Extra. Configuration Files

jest.config.js

Happy Coding! Cheers! :)

tags: #nuxt.js #vue.js #jest #coverage #unittesting #babel #vue-jest #nodejs #npm #vuejs #nuxtjs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store