Skip to content

Commit 92cf328

Browse files
RobPruzanclaude
andcommitted
Fix edge-configurable-runtime test to filter browser logs
The test was checking that 'error' and 'warn' strings don't appear in CLI output, but browser logs could contain these words unrelated to the actual test assertions. Applied filterBrowserLogs to these checks. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent bb8f1d0 commit 92cf328

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/e2e/edge-configurable-runtime/index.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { NextInstance } from 'e2e-utils'
33
import { fetchViaHTTP, File, nextBuild } from 'next-test-utils'
44
import { join } from 'path'
55
import stripAnsi from 'strip-ansi'
6+
import { filterBrowserLogs } from '../../lib/filter-browser-logs'
67

78
const pagePath = 'pages/index.jsx'
89
const apiPath = 'pages/api/edge.js'
@@ -37,8 +38,8 @@ const apiPath = 'pages/api/edge.js'
3738
await next.start()
3839
const res = await fetchViaHTTP(next.url, `/api/edge`)
3940
expect(res.status).toEqual(200)
40-
expect(next.cliOutput).not.toInclude('error')
41-
expect(next.cliOutput).not.toInclude('warn')
41+
expect(filterBrowserLogs(next.cliOutput)).not.toInclude('error')
42+
expect(filterBrowserLogs(next.cliOutput)).not.toInclude('warn')
4243
})
4344

4445
it('warns about API route using experimental-edge runtime', async () => {
@@ -52,7 +53,7 @@ const apiPath = 'pages/api/edge.js'
5253
await next.start()
5354
const res = await fetchViaHTTP(next.url, `/api/edge`)
5455
expect(res.status).toEqual(200)
55-
expect(next.cliOutput).not.toInclude('error')
56+
expect(filterBrowserLogs(next.cliOutput)).not.toInclude('error')
5657
expect(stripAnsi(next.cliOutput)).toInclude(
5758
`/api/edge provided runtime 'experimental-edge'. It can be updated to 'edge' instead.`
5859
)
@@ -68,7 +69,7 @@ const apiPath = 'pages/api/edge.js'
6869
await next.start()
6970
const res = await fetchViaHTTP(next.url, `/`)
7071
expect(res.status).toEqual(200)
71-
expect(next.cliOutput).not.toInclude('error')
72+
expect(filterBrowserLogs(next.cliOutput)).not.toInclude('error')
7273
expect(stripAnsi(next.cliOutput)).toInclude(
7374
`You are using an experimental edge runtime, the API might change.`
7475
)
@@ -88,7 +89,7 @@ const apiPath = 'pages/api/edge.js'
8889
expect(stripAnsi(next.cliOutput)).toInclude(
8990
`Page / provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.`
9091
)
91-
expect(next.cliOutput).not.toInclude('warn')
92+
expect(filterBrowserLogs(next.cliOutput)).not.toInclude('warn')
9293
})
9394
})
9495
} else if ((global as any).isNextStart) {

0 commit comments

Comments
 (0)