Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest coverage reports cause an error with v4.0.0-beta.2 #241

Closed
dschreij opened this issue May 1, 2020 · 21 comments · Fixed by #255 or #275
Closed

Jest coverage reports cause an error with v4.0.0-beta.2 #241

dschreij opened this issue May 1, 2020 · 21 comments · Fixed by #255 or #275

Comments

@dschreij
Copy link

dschreij commented May 1, 2020

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",
@robere2
Copy link

robere2 commented May 5, 2020

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

@laiso
Copy link

laiso commented May 5, 2020

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"

@dschreij
Copy link
Author

dschreij commented May 7, 2020

Yes I updated jest from v24 to v25 I think.

@Petercopter
Copy link

I'm using

babel-jest@25.4.0
jest@25.4.0
nuxt@2.12.2
vue-jest@4.0.0-beta.2

Trying to upgrade to babel-jest@26.0.1 and jest@26.0.1 results in

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

@negibouze
Copy link

@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.

clarkdo added a commit to nuxt/create-nuxt-app that referenced this issue May 18, 2020
ianpurvis added a commit to ianpurvis/purvisresearch.com that referenced this issue May 19, 2020
  Fixes "don't know how to turn this value into a node"
  See issue vuejs/vue-jest#241
Atinux pushed a commit to nuxt/create-nuxt-app that referenced this issue Jun 19, 2020
@bob-lee
Copy link

bob-lee commented Jun 21, 2020

same issue here. going back to jest@24.9.0 and vue-jest@4.0.0-beta.3 for now.

Atinux added a commit to nuxt/create-nuxt-app that referenced this issue Jun 22, 2020
* feat: prepare for Nuxt 2.13

* fix(jest): downgrate vue-jest to v3
pending by vuejs/vue-jest#241

* chore(deps): update all non-major dependencies (#509)

* fix(prettier): add stylelint-config-prettier

* chore(deps): update jest packages (major) (#513)

* chore: add npm registry config

* chore(deps): update all non-major dependencies

* chore(deps): update devdependency @nuxt/typescript-build to v1

* fix(ava): expect vm truthy as vue instance assertion

* chore(deps): update all non-major dependencies

* chore(deps): update all non-major dependencies

* feat(template): remove dotenv module (#544)

* chore: optimize svg & animation (#547)

* feat: add content module (#540)

* chore(deps): update all non-major dependencies

* chore(deps): lock file maintenance (#541)

* v3.0.0

* chore: update snapshots

* chore: update prompts and add TS runtime by default

* chore: fix lint issue

Co-authored-by: Clark Du <clark.duxin@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Martijn Cuppens <martijn.cuppens@gmail.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
@aldarund
Copy link

vue-jest@4.0.0-beta.3 dont work with jest 25 & 26 too, only 3.0.5

@qt911025
Copy link

@rlam3
Copy link

rlam3 commented Sep 5, 2020

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

@lmiller1990
Copy link
Member

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

I wonder if this will fix it: #263.

I will try to review and merge that soon.

@lmiller1990 lmiller1990 reopened this Sep 5, 2020
@aantipov
Copy link

aantipov commented Sep 8, 2020

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

@lmiller1990
Copy link
Member

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

@dschreij
Copy link
Author

dschreij commented Sep 11, 2020

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.

@aantipov
Copy link

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

@aantipov
Copy link

aantipov commented Sep 11, 2020

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

@lmiller1990
Copy link
Member

lmiller1990 commented Sep 12, 2020

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.

@aantipov
Copy link

@lmiller1990 I created a PR #280
Thanks a lot for your work!

@Petercopter
Copy link

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

Thanks everyone!

@lmiller1990
Copy link
Member

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

@aantipov
Copy link

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

omarjmal31 added a commit to omarjmal31/create-nuxt-app that referenced this issue Mar 1, 2021
omarjmal31 pushed a commit to omarjmal31/create-nuxt-app that referenced this issue Mar 1, 2021
* feat: prepare for Nuxt 2.13

* fix(jest): downgrate vue-jest to v3
pending by vuejs/vue-jest#241

* chore(deps): update all non-major dependencies (#509)

* fix(prettier): add stylelint-config-prettier

* chore(deps): update jest packages (major) (#513)

* chore: add npm registry config

* chore(deps): update all non-major dependencies

* chore(deps): update devdependency @nuxt/typescript-build to v1

* fix(ava): expect vm truthy as vue instance assertion

* chore(deps): update all non-major dependencies

* chore(deps): update all non-major dependencies

* feat(template): remove dotenv module (#544)

* chore: optimize svg & animation (#547)

* feat: add content module (#540)

* chore(deps): update all non-major dependencies

* chore(deps): lock file maintenance (#541)

* v3.0.0

* chore: update snapshots

* chore: update prompts and add TS runtime by default

* chore: fix lint issue

Co-authored-by: Clark Du <clark.duxin@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Martijn Cuppens <martijn.cuppens@gmail.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
@wind4gis
Copy link

i faced the same problem, fixed it by upgrade @babel/core version to 7.17.8 or or downgrade to 7.16.2
i debug the code, found that the babel core will trigger when jest-runtime use babel to compile ts code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet