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 25 with node env fails on node 10.14.1 #9453

Closed
AndrewLeedham opened this issue Jan 23, 2020 · 5 comments
Closed

Jest 25 with node env fails on node 10.14.1 #9453

AndrewLeedham opened this issue Jan 23, 2020 · 5 comments

Comments

@AndrewLeedham
Copy link
Contributor

💥 Regression Report

This is more to make people aware of what I found than an issue that should be fixed. After updating to jest 25.1.0 I saw some of my test suites failing with errors like ReferenceError: describe is not defined and ReferenceError: beforeAll is not defined. Turns out the issue only occurs when using "testEnvironment": "node" with node 10.14.1 (and jest 25). Upgrading to node 10.14.2 fixes the issue (or not specifying a testEnvironment), so perhaps a node bug. Either way I wanted to post this here in case anyone comes across the same issue.

Last working version

Worked up to version: 24.*

Stopped working in version: 25.1.0

To Reproduce

Steps to reproduce the behavior:
I created a minimal repro here: https://github.com/AndrewLeedham/repros/tree/1f7e042e241e2f439bd69d1073bafffa5200beb5/packages/jest-25-node

  • I wouldn't clone the repo because it is a monorepo and things get messy with deps. Just download it as a zip I guess.
  • Either use nvm to switch to 10.4.1 or run the docker:build script.
  • Depending on the above either run the test script or docker:test script.

Expected behavior

No errors with global jest functions in test suites.

Link to repl or repo (highly encouraged)

https://github.com/AndrewLeedham/repros/tree/1f7e042e241e2f439bd69d1073bafffa5200beb5/packages/jest-25-node

Run npx envinfo --preset jest

Paste the results here:

System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
  Binaries:
    Node: 10.14.1 - ~/.nvm/versions/node/v10.14.1/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.14.1/bin/npm
@SimenB
Copy link
Member

SimenB commented Jan 23, 2020

Interesting! This was the fix: nodejs/node#23206. Surfaced now since we use vm.compileFunction if it's available.

Good to have the issue for people googling, but I'll close it as it's not actionable 🙂

@SimenB SimenB closed this as completed Jan 23, 2020
bors bot added a commit to comit-network/comit-rs that referenced this issue Mar 5, 2020
2155: Follow-up of #2107 r=mergify[bot] a=D4nte

Also integrates changes from comit-network/comit-js-sdk#145.

2168: Upgrade node to version 12 r=mergify[bot] a=bonomat

@thomaseizinger found an issue describing incompatibility of the node version we are using on circleCI and jest: jestjs/jest#9453.

The tests are running locally. So let's upgrade circleCI as well. 

Co-authored-by: Franck Royer <[email protected]>
Co-authored-by: Philipp Hoenisch <[email protected]>
@manwithsteelnerves
Copy link

manwithsteelnerves commented Mar 13, 2020

For anyone having this issue, just upgrade to node version to 10.14.2 and it should get fixed! #StayAtHome

@pskfyi
Copy link

pskfyi commented Mar 14, 2020

For anyone having this issue, just upgrade to node version to 10.14.2 and it should fix!

@manwithsteelnerves THANK YOU! I would never have thought to check node version while debugging my issue, but this was it.

@SanthoshRaju91
Copy link

@AndrewLeedham, you saved me from head ache brother. Thank you.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants