Skip to content

Commit 4b0a08c

Browse files
rbalicki2rickhanlonii
authored andcommitted
[react devtools] Don't check for NODE_ENV==='test' because it never is (#25186)
* remove useless condition
1 parent 628791b commit 4b0a08c

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

packages/react-devtools-shared/src/backend/renderer.js

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -812,32 +812,28 @@ export function attach(
812812
// Patching the console enables DevTools to do a few useful things:
813813
// * Append component stacks to warnings and error messages
814814
// * Disable logging during re-renders to inspect hooks (see inspectHooksOfFiber)
815-
//
816-
// Don't patch in test environments because we don't want to interfere with Jest's own console overrides.
817-
if (process.env.NODE_ENV !== 'test') {
818-
registerRendererWithConsole(renderer, onErrorOrWarning);
819-
820-
// The renderer interface can't read these preferences directly,
821-
// because it is stored in localStorage within the context of the extension.
822-
// It relies on the extension to pass the preference through via the global.
823-
const appendComponentStack =
824-
window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ !== false;
825-
const breakOnConsoleErrors =
826-
window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ === true;
827-
const showInlineWarningsAndErrors =
828-
window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ !== false;
829-
const hideConsoleLogsInStrictMode =
830-
window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ === true;
831-
const browserTheme = window.__REACT_DEVTOOLS_BROWSER_THEME__;
832-
833-
patchConsole({
834-
appendComponentStack,
835-
breakOnConsoleErrors,
836-
showInlineWarningsAndErrors,
837-
hideConsoleLogsInStrictMode,
838-
browserTheme,
839-
});
840-
}
815+
registerRendererWithConsole(renderer, onErrorOrWarning);
816+
817+
// The renderer interface can't read these preferences directly,
818+
// because it is stored in localStorage within the context of the extension.
819+
// It relies on the extension to pass the preference through via the global.
820+
const appendComponentStack =
821+
window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ !== false;
822+
const breakOnConsoleErrors =
823+
window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ === true;
824+
const showInlineWarningsAndErrors =
825+
window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ !== false;
826+
const hideConsoleLogsInStrictMode =
827+
window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ === true;
828+
const browserTheme = window.__REACT_DEVTOOLS_BROWSER_THEME__;
829+
830+
patchConsole({
831+
appendComponentStack,
832+
breakOnConsoleErrors,
833+
showInlineWarningsAndErrors,
834+
hideConsoleLogsInStrictMode,
835+
browserTheme,
836+
});
841837

842838
const debug = (
843839
name: string,

0 commit comments

Comments
 (0)