@samitouri / QOS-React-2 / commits / 22b2642a56

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

Brian Vaughn committed Oct 9, 2019 at 12:37 UTC 22b2642a565cf9160bbf660ab030d07d8273879e
2 files changed +7 -2
packages/react-devtools-shell/src/app/console.js
+6 -1
@@ -11,7 +11,12 @@ function ignoreStrings(
11 methodName: string,
12 stringsToIgnore: Array<string>,
13 ): void {
14 - const originalMethod = console[methodName];
14 + // HACKY In the test harness, DevTools overrides the parent window's console.
15 + // Our test app code uses the iframe's console though.
16 + // To simulate a more accurate end-ot-end ienvironment,
17 + // the shell's console patching should pass through to the parent override methods.
18 + const originalMethod = window.parent.console[methodName];
19 +
20 console[methodName] = (...args) => {
21 const maybeString = args[0];
22 if (typeof maybeString === 'string') {
packages/react-devtools-shell/src/app/index.js
+1 -1
@@ -31,7 +31,7 @@ ignoreErrors([
31 'Warning: Unsafe lifecycle methods',
32 'Warning: %s is deprecated in StrictMode.', // findDOMNode
33 ]);
34 -ignoreWarnings(['Warning: componentWillReceiveProps is deprecated']);
34 +ignoreWarnings(['Warning: componentWillReceiveProps has been renamed']);
35
36 const roots = [];
37