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

Setting extraGlobals: ['Math'] breaks in v26 #10754

Closed
NiGhTTraX opened this issue Oct 31, 2020 · 2 comments · Fixed by #10758
Closed

Setting extraGlobals: ['Math'] breaks in v26 #10754

NiGhTTraX opened this issue Oct 31, 2020 · 2 comments · Fixed by #10758

Comments

@NiGhTTraX
Copy link
Contributor

💥 Regression Report

TypeError: Math.random is not a function

      at randomIntInRange (node_modules/source-map/lib/quick-sort.js:43:33)

Last working version

Worked up to version: 25.5.4

Stopped working in version: 26.0.0

  • I think it might be related to some transient dependency as I have other repos with jest@~26.4.0 that work just fine, but installing from scratch breaks. Yay lockfiles.

To Reproduce

Steps to reproduce the behavior:

// jest.config.js
module.exports = {
  extraGlobals: ['Math']
}

Expected behavior

Tests pass and accessing Math is fast. See #5163 on why this is needed.

Link to repl or repo (highly encouraged)

https://repl.it/repls/RoundFortunateUnits#jest.config.js

Run npx envinfo --preset jest

Paste the results here:

  Binaries:
    Node: 12.16.0
    Yarn: 1.22.0
    npm: 6.13.4
  npmPackages:
    jest: ~26.0.0 => 26.0.1 

@SimenB
Copy link
Member

SimenB commented Oct 31, 2020

Sorry about that! Inadvertently broken in a refactor. I've landed a fix along with a regression test - will release tomorrow or Monday 🙂

@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

Successfully merging a pull request may close this issue.

2 participants