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

Legacy timers should check for presence in global before adding an immediate #11539

Closed
julienw opened this issue Jun 7, 2021 · 3 comments · Fixed by #11599
Closed

Legacy timers should check for presence in global before adding an immediate #11539

julienw opened this issue Jun 7, 2021 · 3 comments · Fixed by #11599

Comments

@julienw
Copy link

julienw commented Jun 7, 2021

Following up #11511:

🐛 Bug Report

With this:

test('foo', () => {
  jest.useFakeTimers('legacy');
  setImmediate(() => {});
});

I get:
=> TypeError: this._timerAPIs.setImmediate is not a function

We're with the jsdom environment.

@lukeapage
Copy link
Contributor

lukeapage commented Jun 22, 2021

Got this too after upgrading to v27. I'm not sure why. Adding the following to jestSetup stops it happening:

global.setImmediate = global.setTimeout;

more direct references from where it was discussed previously:
#11511 (comment)

#11511 (comment)

@joeldenning
Copy link
Contributor

Still seeing this with jest 27.0.6

@github-actions
Copy link

github-actions bot commented Aug 4, 2021

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 Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants