Unverified Commit 6b2e2a0d authored by OJ Kwon's avatar OJ Kwon Committed by GitHub

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

### What

Small update to test fixture to make test stable.

Closes PACK-2749
parent 955a81bf
...@@ -30,9 +30,16 @@ createNextDescribe( ...@@ -30,9 +30,16 @@ createNextDescribe(
await next.fetch('/') await next.fetch('/')
const output = stripAnsi(next.cliOutput) const output = stripAnsi(next.cliOutput)
await check(() => { await check(() => {
expect(stripAnsi(next.cliOutput)).toMatch( if (process.env.TURBOPACK) {
/middleware.js \(\d+:\d+\) @ Object.default \[as handler\]/ 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/) expect(stripAnsi(next.cliOutput)).toMatch(/boom/)
return 'success' return 'success'
}, 'success') }, 'success')
...@@ -280,8 +287,9 @@ createNextDescribe( ...@@ -280,8 +287,9 @@ createNextDescribe(
}) })
it('logs the error correctly', async () => { it('logs the error correctly', async () => {
await next.fetch('/')
await next.patchFile('middleware.js', `export default function () }`) await next.patchFile('middleware.js', `export default function () }`)
await next.fetch('/')
await check(() => { await check(() => {
expect(next.cliOutput).toContain(`Expected '{', got '}'`) expect(next.cliOutput).toContain(`Expected '{', got '}'`)
expect(next.cliOutput.split(`Expected '{', got '}'`).length).toEqual( expect(next.cliOutput.split(`Expected '{', got '}'`).length).toEqual(
......
...@@ -1915,16 +1915,14 @@ ...@@ -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 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 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 logs the error correctly",
"middleware - development errors when throwing while loading the module renders the error correctly and recovers" "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",
"failed": [
"middleware - development errors when middleware throws synchronously logs the error correctly"
],
"pending": [],
"flakey": [
"middleware - development errors when there is a compilation error after boot 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" "middleware - development errors when there is a compilation error from boot logs the error correctly"
], ],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/development/middleware-warnings/index.test.ts": { "test/development/middleware-warnings/index.test.ts": {
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