Skip to content

Jest 25 with node env fails on node 10.14.1 #9453

@AndrewLeedham

Description

@AndrewLeedham

💥 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions