Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner authored and gnoff committed Mar 25, 2024
1 parent 1a2ce1f commit 84df8ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/next/src/client/app-index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/development/acceptance-app/hydration-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ describe('Error overlay for hydration errors', () => {

const warning = await session.getRedboxDescriptionWarning()
expect(warning).toContain(
'In HTML, <script> cannot be a child of <html>.\nThis will cause a hydration error.'
`Cannot render a sync or defer <script> outside the main document without knowing its order. Try adding async="" or moving it into the root <head> tag.`
)

await cleanup()
Expand Down

0 comments on commit 84df8ad

Please sign in to comment.