fix(turbopack): e2e/404-page-router test (#58146)

This commit is contained in:
Leah 2023-11-22 19:30:26 +01:00 committed by GitHub
parent 98f7994ce8
commit bb3d5cf4c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 16 deletions

View file

@ -1,4 +1 @@
module.exports = {
_basePath: '/docs',
_i18n: { defaultLocale: 'en-ca', locales: ['en-ca', 'en-fr'] },
}
module.exports = {}

View file

@ -29,6 +29,13 @@ const table = [
]),
]
const baseNextConfig = `
module.exports = {
BASE_PATH
I18N
}
`
describe('404-page-router', () => {
let next: NextInstance
@ -64,18 +71,16 @@ describe('404-page-router', () => {
)
)
}
let curNextConfig = await fs.readFile(
path.join(__dirname, 'app', 'next.config.js'),
'utf8'
)
if (options.basePath) {
curNextConfig = curNextConfig.replace('_basePath', 'basePath')
}
let curNextConfig = baseNextConfig
.replace('BASE_PATH', options.basePath ? "basePath: '/docs'," : '')
.replace(
'I18N',
options.i18n
? "i18n: { defaultLocale: 'en-ca', locales: ['en-ca', 'en-fr'] },"
: ''
)
if (options.i18n) {
curNextConfig = curNextConfig.replace('_i18n', 'i18n')
}
await next.patchFile('next.config.js', curNextConfig)
await next.start()
})

View file

@ -2113,8 +2113,7 @@
"runtimeError": false
},
"test/e2e/404-page-router/index.test.ts": {
"passed": [],
"failed": [
"passed": [
"404-page-router 404-page-router with basePath of false and i18n of false and middleware false for /not/a/real/page should have the correct router parameters after it is ready",
"404-page-router 404-page-router with basePath of false and i18n of false and middleware false for /not/a/real/page?with=query should have the correct router parameters after it is ready",
"404-page-router 404-page-router with basePath of false and i18n of false and middleware false should not throw any errors when re-fetching the route info",
@ -2128,6 +2127,7 @@
"404-page-router 404-page-router with basePath of true and i18n of true and middleware false for /not/a/real/page?with=query should have the correct router parameters after it is ready",
"404-page-router 404-page-router with basePath of true and i18n of true and middleware false should not throw any errors when re-fetching the route info"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": true