-
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
Update to Jest 22 #11956
Update to Jest 22 #11956
Changes from 7 commits
2ab6aeb
ac83604
91c30e2
c8e8795
fa5770f
6101acd
7956d72
5e739bc
9dc3a61
6680473
7cd3cf8
1ba6a45
ed93325
14805c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,20 @@ global.cancelIdleCallback = function(callbackID) { | |
// for the few that specifically test the logging by shadowing this | ||
// property. In real apps, it would usually not be defined at all. | ||
Error.prototype.suppressReactErrorLogging = true; | ||
if (typeof DOMException === 'function') { | ||
|
||
if (typeof window !== 'undefined') { | ||
// Same as above. | ||
DOMException.prototype.suppressReactErrorLogging = true; | ||
|
||
// Also prevent JSDOM from logging intentionally thrown errors. | ||
// TODO: it might make sense to do it the other way around. | ||
// https://github.com/facebook/react/issues/11098#issuecomment-355032539 | ||
window.addEventListener('error', event => { | ||
if (event.error != null && event.error.suppressReactErrorLogging) { | ||
event.preventDefault(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be worth ensuring these are logged somewhere. I noticed on RDL that errors thrown in event handlers where being swallowed by jsdom under mysterious circumstances...I guess there is already an issue for it tho: #8260 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, thanks for highlighting that. They are logged now (by jsdom) but we should probably fail the build on them (?) This issue (and related PR) is actually why I got curious about updating jsdom :P |
||
}); | ||
|
||
// Mock for ReactART. | ||
HTMLCanvasElement.prototype.getContext = () => ({}); | ||
} |
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.
We weren't using these anymore
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.
expect
is still in here in beta, is that used?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.
Probably not..