test(fixture): update middleware test fixture & manifest (#63340)

### What

Small update to test fixture to make test stable.

Closes PACK-2749
This commit is contained in:
OJ Kwon 2024-03-15 15:12:24 -07:00 committed by GitHub
parent 955a81bf39
commit 6b2e2a0d2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 11 deletions

View file

@ -30,9 +30,16 @@ createNextDescribe(
await next.fetch('/')
const output = stripAnsi(next.cliOutput)
await check(() => {
expect(stripAnsi(next.cliOutput)).toMatch(
/middleware.js \(\d+:\d+\) @ Object.default \[as handler\]/
)
if (process.env.TURBOPACK) {
expect(stripAnsi(next.cliOutput)).toMatch(
/middleware.js \(\d+:\d+\) @ Object.__TURBOPACK__default__export__ \[as handler\]/
)
} else {
expect(stripAnsi(next.cliOutput)).toMatch(
/middleware.js \(\d+:\d+\) @ Object.default \[as handler\]/
)
}
expect(stripAnsi(next.cliOutput)).toMatch(/boom/)
return 'success'
}, 'success')
@ -280,8 +287,9 @@ createNextDescribe(
})
it('logs the error correctly', async () => {
await next.fetch('/')
await next.patchFile('middleware.js', `export default function () }`)
await next.fetch('/')
await check(() => {
expect(next.cliOutput).toContain(`Expected '{', got '}'`)
expect(next.cliOutput.split(`Expected '{', got '}'`).length).toEqual(

View file

@ -1915,16 +1915,14 @@
"middleware - development errors when there is an unhandled rejection while loading the module does not render the error",
"middleware - development errors when there is an unhandled rejection while loading the module logs the error correctly",
"middleware - development errors when throwing while loading the module logs the error correctly",
"middleware - development errors when throwing while loading the module renders the error correctly and recovers"
],
"failed": [
"middleware - development errors when middleware throws synchronously logs the error correctly"
],
"pending": [],
"flakey": [
"middleware - development errors when throwing while loading the module renders the error correctly and recovers",
"middleware - development errors when middleware throws synchronously logs the error correctly",
"middleware - development errors when there is a compilation error after boot logs the error correctly",
"middleware - development errors when there is a compilation error from boot logs the error correctly"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false
},
"test/development/middleware-warnings/index.test.ts": {