Files
next.js/test/e2e/app-dir/app-middleware/app-middleware-without-pages-dir.test.ts
Jiwon ChoiandGitHub d5170ebde4 test: split app-middleware test per describe (#84130)
A single test file is starting 3 next instances sequentially. This can be paralleled from different test files. This PR splits tests per "describe" and does not change its content.
2025-09-23 21:16:08 +02:00

30 lines
736 B
TypeScript

/* eslint-env jest */
import path from 'path'
import { nextTestSetup, FileRef } from 'e2e-utils'
describe('app dir - middleware without pages dir', () => {
const { next } = nextTestSetup({
files: {
app: new FileRef(path.join(__dirname, 'app')),
'next.config.js': new FileRef(path.join(__dirname, 'next.config.js')),
'middleware.js': `
import { NextResponse } from 'next/server'
export async function middleware(request) {
return new NextResponse('redirected')
}
export const config = {
matcher: '/headers'
}
`,
},
})
it('Updates headers', async () => {
const html = await next.render('/headers')
expect(html).toContain('redirected')
})
})