-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
fix(env-jsdom): remove setImmediate
and clearImmediate
#11222
Conversation
Bah, this fails since |
7bde71e
to
aea4188
Compare
aea4188
to
1e15a27
Compare
packages/jest-runtime/src/index.ts
Outdated
@@ -1823,6 +1821,11 @@ export default class Runtime { | |||
throw moduleNotFoundError; | |||
} | |||
|
|||
e.message = `Jest: Got error evaluating ${path.relative( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's not have that now though to reduce the surface of this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow I ran into that reference error yesterday for some reasons and it was gone out of the blue
This breaks |
packages/jest-runner/src/runTest.ts
Outdated
) | ||
.install(sourcemapOptions); | ||
if (isBrowserEnv) { | ||
runtime.requireInternalModule( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LinusU any ideas about what's happening here? I'm having some issues reproducing this using plain JSDOM
, so I'm not really sure where to begin debugging this...
Might land removal of |
Does testing-library/dom-testing-library#916 unblock you? |
Yep, it does! 👍 If it's merged and released I'll just keep the Alternatively I can just use |
Hi @SimenB, I added the following test case in order to reproduce the issue. Let me know if that covers it. test('safe check for setImmediate and clearImmediate', () => {
const setImeediate = global.setImmediate
const clearImmediate = global.clearImmediate
delete global.setImmediate
delete global.clearImmediate
expect(() => runWithRealTimers(() => {})).not.toThrow()
global.setImmediate = setImeediate
global.clearImmediate = clearImmediate
}) |
From the tests I've made it throws the same exception. |
@renatoalencar I don't understand what line is pictured on your screenshot. It shouldn't exist after your change, should it? |
Yeah, I just putted it there so I could reproduce the error through the tests. I wanted to see if that would happen by just deleting I wrote the tests after the code, so I'm just showing that they really cover this case. |
Ahh got it. |
setImmediate
and clearImmediate
Following up on Buffer here: #11241 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Fixes #11204
Test plan
Green CI