-
Notifications
You must be signed in to change notification settings - Fork 47k
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
chore: Add document is null check in invariant #20887
Conversation
Comparing: 2e8bbcb...42adb80 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
hi @acdlite, could you pls take a look? thanks~ |
cc @bvaughn |
cc @gaearon |
cc @sebmarkbage |
@zombieJ Don't spam mentions. There are a lot of PRs waiting for review. The team will review them when we get the opportunity. |
Thanks for reply. |
Hi @bvaughn, |
Hey @zombieJ, thanks for the suggestion and I'm super sorry for the delay. The real issue here is that this code is firing after jest has torn down the environment at all. To fix the core issue, we've created #20915, but that's a breaking change so we've been waiting until we're ready for the next release to land it. |
Summary
In jest, when a test is ended, it will make document as
null
instead ofundefined
. So the invariant oftypeof document !== 'undefined'
will miss the case ofnull
.Test Plan
Update
ReactDOM-test.js
fornull
case.