Vue-jest: Jest coverage reports cause an error with v4.0.0-beta.2

Created on 1 May 2020  ·  20Comments  ·  Source: vuejs/vue-jest


I just decided to give the latest beta a spin, and it worked well for running the unit tests, but when also trying to add a coverage report, I got:

resources/components/NotificationBox/NotificationBox.spec.js
  ● Test suite failed to run

    /home/daniel/Repos/omm/resources/components/NotificationBox/NotificationBox.vue: don't know how to turn this value into a node

      at valueToNode (node_modules/@babel/core/node_modules/@babel/types/lib/converters/valueToNode.js:87:9)
      at Object.valueToNode (node_modules/@babel/core/node_modules/@babel/types/lib/converters/valueToNode.js:81:58)
      at Object.exit (node_modules/istanbul-lib-instrument/dist/visitor.js:638:30)
      at PluginPass.exit (node_modules/babel-plugin-istanbul/lib/index.js:158:38)
      at newFn (node_modules/@babel/core/node_modules/@babel/traverse/lib/visitors.js:179:21)
      at NodePath._call (node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:55:20)
      at NodePath.call (node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:42:17)
      at NodePath.visit (node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:99:8)
      at TraversalContext.visitQueue (node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:112:16)
      at TraversalContext.visitSingle (node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:84:19)
      at TraversalContext.visit (node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:140:19)
      at Function.traverse.node (node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:84:17)
      at traverse (node_modules/@babel/core/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)

Downgrading to v3.0.5 fixed the issue and printed out coverage reports again.

I am using:

"babel-jest": "^25.5.1",
"jest": "^25.5.3",
"nuxt": "^2.12.2",

Most helpful comment

I'm using

[email protected]
[email protected]
[email protected]
[email protected]

Trying to upgrade to [email protected] and [email protected] results in

don't know how to turn this value into a node

All 20 comments

Did you update any other dependencies? Seems like this might be some sort of conflict between at least Jest 25.5.3 and later and 4.0.0-beta.2.
I had no problems with 4.0.0-beta.2 until I made the following changes to my dependencies:

    "jest": "^24.1.0",
    "vue-jest": "^4.0.0-beta.2"

Changed to:

    "babel-core": "^7.0.0-0",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^25.5.4",
    "vue-jest": "^3.0.5" // Downgraded to fix the issue

I have the same problem, and when I fix JEST to V24, the coverage report output is successful.

"jest": "~> 24.9.0",
"vue-jest": "beta"

Yes I updated jest from v24 to v25 I think.

I'm using

[email protected]
[email protected]
[email protected]
[email protected]

Trying to upgrade to [email protected] and [email protected] results in

don't know how to turn this value into a node

@Petercopter
I met a same issue.
I want to downgrade Jest to v25.4.0, but Jest has the following dependencies.

"dependencies": {
    "@jest/core": "^25.4.0",
    "import-local": "^3.0.2",
    "jest-cli": "^25.4.0"
  },

So I can't downgrade @jest/core to v25.4.0.

same issue here. going back to [email protected] and [email protected] for now.

[email protected] dont work with jest 25 & 26 too, only 3.0.5

Is this fixed for "vue-jest": "^5.0.0-alpha.3" ?
I am getting the same error when using "jest": "^26.4.2

I don't think this is fixed in alpha 5.

I wonder if this will fix it: https://github.com/vuejs/vue-jest/pull/263.

I will try to review and merge that soon.

As I commented in the PR, the fix is not in the latest v4.0.0-beta.5.
Please add it there and release a new version

Right, I misunderstood. I released v4.0.0-beta.6. I hope this fixes this issue.

Hi @lmiller1990
Thanks for your work on this. I am on 4.0.0-beta.6 now, but I am still getting the same error message when trying to generate coverage reports. Does it work for you with the latest release?
A sidenote: I installed it from github since I don't think the latest beta versions are on npm yet?

Moreover, my tests now appear to fail for all .vue files when running with coverage, while these pass whenever I run jest with the --no-coverage flag.

I just tried to update to v4.0.0-beta.6 and unfortunately I also still getting the same error don't know how to turn this value into a node
I tried with latest 25.x and 26.x Jest versions.

Also another minor thing: with the latest 26.x Jest I get warnings from ts-jest:

ts-jest[versions] (WARN) Version 26.4.2 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=25.0.0 <26.0.0). Please do not report issues in ts-jest if you are using unsupported versions.

Would be nice if version of ts-jest could be bumped

@lmiller1990 It looks like the fix is not in the v4.0.0-beta.6
image

Weird, I thought I checked for this.

Can you make a PR and I can merge and release it?

PS: you should be able to install your own version of ts-jest to get away from this error. But I think we can probably update ts-jest and jest to v26.0.0 - what do you think? I might bump to rc.0 for this release.

If you would like to make a PR with both those changes, I can test and release in the next 24-48h. Thanks for following up on this - I appreciate it.

@lmiller1990 I created a PR https://github.com/vuejs/vue-jest/pull/280
Thanks a lot for your work!

New version checks out! I was able to upgrade to Jest 26, and everything looks good. Release candidate! 🎉

Thanks everyone!

Great job @aantipov on this and tahnks to @Petercopter for testing 👍

I just tested and it works!
I'm glad I could help with it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eddyerburgh picture eddyerburgh  ·  7Comments

xereda picture xereda  ·  4Comments

vincemukiiri picture vincemukiiri  ·  9Comments

emman27 picture emman27  ·  7Comments

ccamarat picture ccamarat  ·  7Comments