Skip to content

Commit e2fa20f

Browse files
committed
migrate test
1 parent 0ba1c20 commit e2fa20f

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

test/e2e/app-dir/app-external/app-external.test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ createNextDescribe(
3737
buildCommand: 'yarn build',
3838
skipDeployment: true,
3939
},
40-
({ next, isNextStart }) => {
40+
({ next }) => {
4141
it('should be able to opt-out 3rd party packages being bundled in server components', async () => {
4242
await next.fetch('/react-server/optout').then(async (response) => {
4343
const result = await resolveStreamResponse(response)
@@ -246,15 +246,13 @@ createNextDescribe(
246246
})
247247

248248
it('should have proper tree-shaking for known modules in CJS', async () => {
249-
const html = await next.render('/test-middleware')
250-
expect(html).toContain('it works')
249+
const html = await next.render('/cjs/server')
250+
expect(html).toContain('resolve response')
251251

252-
if (isNextStart) {
253-
const middlewareBundle = await next.readFile(
254-
'.next/server/middleware.js'
255-
)
256-
expect(middlewareBundle).not.toContain('image-response')
257-
}
252+
const outputFile = await next.readFile(
253+
'.next/server/app/cjs/server/page.js'
254+
)
255+
expect(outputFile).not.toContain('image-response')
258256
})
259257

260258
it('should use the same async storages if imported directly', async () => {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createResponse } from 'next-server-cjs-lib'
2+
3+
export default async function Page() {
4+
const response = createResponse('resolve response')
5+
const text = await response.text()
6+
return <p>{text}</p>
7+
}
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
import { createResponse } from 'next-server-cjs-lib'
21
import { respond } from 'compat-next-server-module'
32

43
export async function middleware(request) {
5-
if (request.nextUrl.pathname === '/test-middleware') {
6-
return createResponse('it works')
7-
}
8-
94
return await respond()
105
}

0 commit comments

Comments
 (0)