[react devtools] Don't check for NODE_ENV==='test' because it never is (#25186)
* remove useless condition
Robert Balicki committed
Sep 9, 2022 at 11:31 UTC
425f9fbba0266836a13f391aab0571193a0a4058
1 file changed
+22
-26
packages/react-devtools-shared/src/backend/renderer.js
+22
-26
@@ -812,32 +812,28 @@ export function attach(
812
// Patching the console enables DevTools to do a few useful things:
813
// * Append component stacks to warnings and error messages
814
// * 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
+ });
837
838
const debug = (
839
name: string,