question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jest 27: tests fail on node 10 related to `globalThis`

See original GitHub issue

🐛 Bug Report

On Node 10, tests failed with error related to globalThis

Test suite failed to run

    evalmachine.<anonymous>:1
    globalThis
    ^

    ReferenceError: globalThis is not defined

      at evalmachine.<anonymous>:1:1

To Reproduce

For some reasons I cannot reproduce on my Mac, but it happened to CI. See https://github.com/thymikee/jest-preset-angular/pull/676/checks?check_run_id=1570469726

Steps to reproduce the behavior:

Related PR https://github.com/thymikee/jest-preset-angular/pull/676

Expected behavior

Should not throw error related to globalThis, like Node 12 and Node 14.

Link to repl or repo (highly encouraged)

https://github.com/ahnpnl/jest-preset-angular/tree/jest-27

envinfo

System:
    OS: macOS 11.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 14.15.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.0.15 - /usr/local/bin/npm
  npmPackages:
    jest: 27.0.0-next.2 => 27.0.0-next.2 

cc @SimenB @thymikee

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
SimenBcommented, Dec 17, 2020

There is a stalled PR fixing it: https://github.com/jsdom/jsdom/pull/2975

0reactions
github-actions[bot]commented, May 1, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - Jest
Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why​. Try using the debugging support built into...
Read more >
Jest test fails with "window is not defined" - Stack Overflow
Jest's testEnvironment default used to be jsdom . It was changed to node starting with version 27. You can set testEnvironment: 'jsdom' in...
Read more >
ts-jest - npm
A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript. Latest version: 29.0.3, ...
Read more >
How to use the jest-util.installCommonGlobals function ... - Snyk
defaultView); // Node's error-message stack size is limited at 10, but it's pretty useful // to see more than that when a test...
Read more >
jest | Yarn - Package Manager
Delightful JavaScript Testing. ... Instant Feedback: Failed tests run first. ... between running all tests or only test files related to changed files....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found