Skip to content

Commit 88de232

Browse files
Timertimneutkens
authored andcommitted
Enable Page Symbol For /_error (#9730)
1 parent 5a8ae91 commit 88de232

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

packages/next/build/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export async function printTreeView(
104104

105105
messages.push([
106106
`${symbol} ${
107-
item.startsWith('/_')
107+
item === '/_app'
108108
? ' '
109109
: pageInfo && pageInfo.static
110110
? '○'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Error() {
2+
return <p>An error has occurred</p>
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function() {
2+
return <div />
3+
}

test/integration/build-output/test/index.test.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('Build Output', () => {
7272
})
7373

7474
expect(stdout).toMatch(/\/ [ ]* \d{1,} B/)
75-
expect(stdout).toMatch(/\/_error [ ]* \d{1,} B/)
75+
expect(stdout).toMatch(/λ \/_error [ ]* \d{1,} B/)
7676
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
7777
expect(stdout).toMatch(/ runtime\/main\.js [ 0-9.]* kB/)
7878

@@ -83,4 +83,29 @@ describe('Build Output', () => {
8383
expect(stdout).toContain('○ /')
8484
})
8585
})
86+
87+
describe('Custom Static Error Output', () => {
88+
const appDir = join(fixturesDir, 'with-error-static')
89+
90+
beforeAll(async () => {
91+
await remove(join(appDir, '.next'))
92+
})
93+
94+
// FIXME: this should be static
95+
xit('should specify /_error as static', async () => {
96+
const { stdout } = await nextBuild(appDir, [], {
97+
stdout: true,
98+
})
99+
expect(stdout).toContain('○ /_error')
100+
})
101+
102+
// This test is not really correct.
103+
// Remove this when fixed and enable the above one.
104+
it('should specify /_error as lambda even when static', async () => {
105+
const { stdout } = await nextBuild(appDir, [], {
106+
stdout: true,
107+
})
108+
expect(stdout).toContain('λ /_error')
109+
})
110+
})
86111
})

0 commit comments

Comments
 (0)