From 84df8adb8e52eb7e3bcc13bc20096b953dd3ee1d Mon Sep 17 00:00:00 2001 From: Zack Tanner Date: Thu, 21 Mar 2024 15:43:13 -0700 Subject: [PATCH] test fixes --- packages/next/src/client/app-index.tsx | 5 ++++- test/development/acceptance-app/hydration-error.test.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/next/src/client/app-index.tsx b/packages/next/src/client/app-index.tsx index e4c9d7632d7b8..f51ee2536c873 100644 --- a/packages/next/src/client/app-index.tsx +++ b/packages/next/src/client/app-index.tsx @@ -19,7 +19,10 @@ import { HMR_ACTIONS_SENT_TO_BROWSER } from '../server/dev/hot-reloader-types' // Since React doesn't call onerror for errors caught in error boundaries. const origConsoleError = window.console.error window.console.error = (...args) => { - if (isNextRouterError(args[0])) { + // in dev, the actual error is the second argument. + const error = process.env.NODE_ENV === 'development' ? args[1] : args[0] + + if (isNextRouterError(error)) { return } origConsoleError.apply(window.console, args) diff --git a/test/development/acceptance-app/hydration-error.test.ts b/test/development/acceptance-app/hydration-error.test.ts index 26b8e9d0cc4b1..1414b2ceb394a 100644 --- a/test/development/acceptance-app/hydration-error.test.ts +++ b/test/development/acceptance-app/hydration-error.test.ts @@ -570,7 +570,7 @@ describe('Error overlay for hydration errors', () => { const warning = await session.getRedboxDescriptionWarning() expect(warning).toContain( - 'In HTML,