-
Notifications
You must be signed in to change notification settings - Fork 50.5k
Closed
Labels
Component: Core UtilitiesResolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityType: Feature Request
Description
I'd like to configure my testsuite to fail if there are any react warnings triggered.
I'm currently using a variant on this SO answer http://stackoverflow.com/questions/29651950/karma-and-react-have-warnings-to-cause-errors
console.warn = (function(warn) {
return function(msg) {
// Detect react warnings & error
if (/^Warning: /.test(msg)) {
throw new Error("React " + msg);
}
return warn.apply(this, arguments);
};
})(console.warn);This basically works, but has a problem because there's some global-state memoisation in the code which triggers warning to try not to trigger too often:
| var ownerHasKeyUseWarning = {}; |
Could we provide a way to clear this state, or even better a supported API for opt-in erroring on warnings?
pelotom, rovolution, eps1lon, screendriver, dtinth and 1 more
Metadata
Metadata
Assignees
Labels
Component: Core UtilitiesResolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityType: Feature Request