MCPcopy
hub / github.com/vercel/next.js / runTests

Function runTests

test/integration/500-page/test/index.test.ts:30–60  ·  view source on GitHub ↗
(mode = 'server')

Source from the content-addressed store, hash-verified

28let app
29
30const runTests = (mode = 'server') => {
31 it('should use pages/500', async () => {
32 const html = await renderViaHTTP(appPort, '/500')
33 expect(html).toContain('custom 500 page')
34 })
35
36 it('should set correct status code with pages/500', async () => {
37 const res = await fetchViaHTTP(appPort, '/500')
38 expect(res.status).toBe(500)
39 })
40
41 it('should not error when visited directly', async () => {
42 const res = await fetchViaHTTP(appPort, '/500')
43 expect(res.status).toBe(500)
44 expect(await res.text()).toContain('custom 500 page')
45 })
46
47 if (mode !== 'dev') {
48 it('should output 500.html during build', async () => {
49 const page = getPageFileFromPagesManifest(appDir, '/500')
50 expect(page.endsWith('.html')).toBe(true)
51 })
52
53 it('should add /500 to pages-manifest correctly', async () => {
54 const manifest = await fs.readJSON(
55 join(appDir, '.next', mode, 'pages-manifest.json')
56 )
57 expect('/500' in manifest).toBe(true)
58 })
59 }
60}
61
62describe('500 Page Support', () => {
63 ;(process.env.TURBOPACK_BUILD ? describe.skip : describe)(

Callers 1

index.test.tsFile · 0.70

Calls 9

renderViaHTTPFunction · 0.90
fetchViaHTTPFunction · 0.90
joinFunction · 0.90
readJSONMethod · 0.80
textMethod · 0.65
itFunction · 0.50
expectFunction · 0.50
endsWithMethod · 0.45

Tested by

no test coverage detected