From 22b2642a565cf9160bbf660ab030d07d8273879e Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 9 Oct 2019 12:37:25 -0700 Subject: [PATCH] DevTools test shell tweaks (#17054) * Updated DevTools shell ignore warning message to account for recent changes in warning text * Update DevTools console patching to patch the parent window's console rather than the iframe, to more accurately simulate real usage environment --- packages/react-devtools-shell/src/app/console.js | 7 ++++++- packages/react-devtools-shell/src/app/index.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/react-devtools-shell/src/app/console.js b/packages/react-devtools-shell/src/app/console.js index e41daa76d4269..9ae0e1ce84d6a 100644 --- a/packages/react-devtools-shell/src/app/console.js +++ b/packages/react-devtools-shell/src/app/console.js @@ -11,7 +11,12 @@ function ignoreStrings( methodName: string, stringsToIgnore: Array, ): void { - const originalMethod = console[methodName]; + // HACKY In the test harness, DevTools overrides the parent window's console. + // Our test app code uses the iframe's console though. + // To simulate a more accurate end-ot-end ienvironment, + // the shell's console patching should pass through to the parent override methods. + const originalMethod = window.parent.console[methodName]; + console[methodName] = (...args) => { const maybeString = args[0]; if (typeof maybeString === 'string') { diff --git a/packages/react-devtools-shell/src/app/index.js b/packages/react-devtools-shell/src/app/index.js index 45cffcf1af270..8483be6b050a9 100644 --- a/packages/react-devtools-shell/src/app/index.js +++ b/packages/react-devtools-shell/src/app/index.js @@ -31,7 +31,7 @@ ignoreErrors([ 'Warning: Unsafe lifecycle methods', 'Warning: %s is deprecated in StrictMode.', // findDOMNode ]); -ignoreWarnings(['Warning: componentWillReceiveProps is deprecated']); +ignoreWarnings(['Warning: componentWillReceiveProps has been renamed']); const roots = [];