Unverified Commit 7ac4eae0 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub
parent 3f9f403a
import { runErrorRecoveryHmrTest } from './run-error-recovery-hmr-test.util'
const nextConfig = { basePath: '', assetPrefix: '' }
describe(`HMR - Error Recovery, nextConfig: ${JSON.stringify(nextConfig)}`, () => {
runErrorRecoveryHmrTest(nextConfig)
})
import { runErrorRecoveryHmrTest } from './run-error-recovery-hmr-test.util'
const nextConfig = { basePath: '', assetPrefix: '/asset-prefix' }
describe(`HMR - Error Recovery, nextConfig: ${JSON.stringify(nextConfig)}`, () => {
runErrorRecoveryHmrTest(nextConfig)
})
import { runErrorRecoveryHmrTest } from './run-error-recovery-hmr-test.util'
const nextConfig = { basePath: '/docs', assetPrefix: '' }
describe(`HMR - Error Recovery, nextConfig: ${JSON.stringify(nextConfig)}`, () => {
runErrorRecoveryHmrTest(nextConfig)
})
import { runErrorRecoveryHmrTest } from './run-error-recovery-hmr-test.util'
const nextConfig = { basePath: '/docs', assetPrefix: '/asset-prefix' }
describe(`HMR - Error Recovery, nextConfig: ${JSON.stringify(nextConfig)}`, () => {
runErrorRecoveryHmrTest(nextConfig)
})
import type { NextConfig } from 'next'
import { join } from 'path' import { join } from 'path'
import { import {
assertHasRedbox, assertHasRedbox,
...@@ -15,14 +14,10 @@ import { ...@@ -15,14 +14,10 @@ import {
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { outdent } from 'outdent' import { outdent } from 'outdent'
describe.each([ export function runErrorRecoveryHmrTest(nextConfig: {
{ basePath: '', assetPrefix: '' }, basePath: string
{ basePath: '', assetPrefix: '/asset-prefix' }, assetPrefix: string
{ basePath: '/docs', assetPrefix: '' }, }) {
{ basePath: '/docs', assetPrefix: '/asset-prefix' },
])(
'HMR - Error Recovery, nextConfig: %o',
(nextConfig: Partial<NextConfig>) => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
nextConfig, nextConfig,
...@@ -167,9 +162,7 @@ describe.each([ ...@@ -167,9 +162,7 @@ describe.each([
await next.patchFile(aboutPage, aboutContent.replace('</div>', 'div')) await next.patchFile(aboutPage, aboutContent.replace('</div>', 'div'))
await assertHasRedbox(browser) await assertHasRedbox(browser)
const source = next.normalizeTestDirContent( const source = next.normalizeTestDirContent(await getRedboxSource(browser))
await getRedboxSource(browser)
)
if (basePath === '' && process.env.IS_TURBOPACK_TEST) { if (basePath === '' && process.env.IS_TURBOPACK_TEST) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
...@@ -708,10 +701,7 @@ describe.each([ ...@@ -708,10 +701,7 @@ describe.each([
./pages/hmr/about9.js" ./pages/hmr/about9.js"
`) `)
} else { } else {
redboxSource = redboxSource.substring( redboxSource = redboxSource.substring(0, redboxSource.indexOf('`----'))
0,
redboxSource.indexOf('`----')
)
expect(next.normalizeTestDirContent(redboxSource)) expect(next.normalizeTestDirContent(redboxSource))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
...@@ -838,5 +828,4 @@ describe.each([ ...@@ -838,5 +828,4 @@ describe.each([
expect(traceData).toContain('client-full-reload') expect(traceData).toContain('client-full-reload')
}) })
} }
} }
)
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