workaround T43930203 where originalConsole.assert doesn't properly check the condition and always fires

Summary: Workaround for bugs with originalConsole.assert firing when it shouldn't.

Reviewed By: Hypuk

Differential Revision: D15201459

fbshipit-source-id: d4cf648725cf42754561468b23ea8edd7c1b84b2
This commit is contained in:
Spencer Ahrens
2019-05-03 12:20:30 -07:00
committed by Facebook Github Bot
parent 920632cadb
commit a87af19d3f

View File

@@ -557,7 +557,15 @@ if (global.nativeLoggingHook) {
const reactNativeMethod = console[methodName];
if (originalConsole[methodName]) {
console[methodName] = function() {
originalConsole[methodName](...arguments);
// TODO(T43930203): remove this special case once originalConsole.assert properly checks
// the condition
if (methodName === 'assert') {
if (!arguments[0]) {
originalConsole.assert(...arguments);
}
} else {
originalConsole[methodName](...arguments);
}
reactNativeMethod.apply(console, arguments);
};
}