Unverified Commit b84952f0 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[test] Use new Redbox matchers in pages/ ReactRefreshRegression (#76743)

parent 094d9096
...@@ -6,7 +6,7 @@ import { outdent } from 'outdent' ...@@ -6,7 +6,7 @@ import { outdent } from 'outdent'
import path from 'path' import path from 'path'
describe('ReactRefreshRegression', () => { describe('ReactRefreshRegression', () => {
const { next } = nextTestSetup({ const { isTurbopack, next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
skipStart: true, skipStart: true,
dependencies: { dependencies: {
...@@ -268,7 +268,7 @@ describe('ReactRefreshRegression', () => { ...@@ -268,7 +268,7 @@ describe('ReactRefreshRegression', () => {
// https://github.com/vercel/next.js/issues/11504 // https://github.com/vercel/next.js/issues/11504
test('shows an overlay for a server-side error', async () => { test('shows an overlay for a server-side error', async () => {
await using sandbox = await createSandbox(next) await using sandbox = await createSandbox(next)
const { session } = sandbox const { browser, session } = sandbox
await session.patch( await session.patch(
'pages/index.js', 'pages/index.js',
...@@ -281,14 +281,38 @@ describe('ReactRefreshRegression', () => { ...@@ -281,14 +281,38 @@ describe('ReactRefreshRegression', () => {
) )
expect(didNotReload).toBe(false) expect(didNotReload).toBe(false)
await session.assertHasRedbox() if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
const source = await session.getRedboxSource() {
expect(source.split(/\r?\n/g).slice(2).join('\n').replace(/^\n+/, '')) "count": 1,
.toMatchInlineSnapshot(` "description": "Error: boom",
"> 1 | export default function () { throw new Error('boom'); } "environmentLabel": null,
| ^" "label": "Runtime Error",
`) "source": "pages/index.js (1:36) @
{default export}
> 1 | export default function () { throw new Error('boom'); }
| ^",
"stack": [
"{default export} pages/index.js (1:36)",
],
}
`)
} else {
await expect(browser).toDisplayRedbox(`
{
"count": 1,
"description": "Error: boom",
"environmentLabel": null,
"label": "Runtime Error",
"source": "pages/index.js (1:36) @ default
> 1 | export default function () { throw new Error('boom'); }
| ^",
"stack": [
"default pages/index.js (1:36)",
],
}
`)
}
}) })
// https://github.com/vercel/next.js/issues/13574 // https://github.com/vercel/next.js/issues/13574
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment