Skip to content

Commit

Permalink
DevTools test shell tweaks (#17054)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Brian Vaughn authored Oct 9, 2019
1 parent 4be45be commit 22b2642
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/react-devtools-shell/src/app/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ function ignoreStrings(
methodName: string,
stringsToIgnore: Array<string>,
): 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') {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-shell/src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down

0 comments on commit 22b2642

Please sign in to comment.