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

Regression: runtime.setGlobalsForRuntime is not a function jest-circus 26.5.0 #10591

Closed
SkeLLLa opened this issue Oct 5, 2020 · 6 comments
Closed

Comments

@SkeLLLa
Copy link

SkeLLLa commented Oct 5, 2020

💥 Regression Report

Updating jest to 26.5.0 with jest-circus runner started to throw an error:

    TypeError: runtime.setGlobalsForRuntime is not a function

      at jestAdapter (node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:96:11)

Last working version

Worked up to version:
jest: 26.4.X
jest-circus: 26.4.X

Stopped working in version:
jest: 26.5.0
jest-circus: 26.5.0

To Reproduce

Steps to reproduce the behavior:

I'm not sure what exactly cause the issue, but maybe it's code that looks like:

global.foo = 'bar'

in global setup scripts.

Expected behavior

Not throw an error

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  Binaries:
    Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
    npm: 6.14.5 - ~/.nvm/versions/node/v12.18.2/bin/npm
  npmPackages:
    jest: ^26.4.2 => 26.5.0 
@SkeLLLa SkeLLLa changed the title Regression: runtime.setGlobalsForRuntime is not a function jest 26.5.0 Regression: runtime.setGlobalsForRuntime is not a function jest-circus 26.5.0 Oct 5, 2020
@SimenB
Copy link
Member

SimenB commented Oct 5, 2020

Unable to reproduce this one... What version of jest-runtime do you have in your node_modules? It should be 26.5.0 (same as jest) but maybe something went wrong?

@SimenB SimenB closed this as completed in 9d977bc Oct 5, 2020
@SimenB
Copy link
Member

SimenB commented Oct 5, 2020

@SkeLLLa added some defensive code for version mismatch, please try https://github.com/facebook/jest/releases/tag/v26.5.1

@SkeLLLa
Copy link
Author

SkeLLLa commented Oct 5, 2020

@SimenB thanks.
however I think I've found what could cause an issue. For some tests I use https://www.npmjs.com/package/jest-serial-runner and seems it uses obsolete runtime - jest-runner@24.9.0

@SimenB
Copy link
Member

SimenB commented Oct 5, 2020

That seems likely, yeah. We might need to add some sort of version requirement here - we get an instance of runtime passed by jest-runner, so our own version ranges are possibly outdated/misleading if people use custom runners.

Regardless, the extra safety I added is a good idea for Jest 26 as people might install a newer jest-circus than their main jest installation, which would lead to the same error

@SimenB
Copy link
Member

SimenB commented Oct 5, 2020

As for jest-serial-runner specifically, it should have a peerDependency on jest-runner so people can provide their own version of it.

@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

2 participants