Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Page Symbol For /_error #9730

Merged
merged 1 commit into from
Dec 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export async function printTreeView(

messages.push([
`${symbol} ${
item.startsWith('/_')
item === '/_app'
? ' '
: pageInfo && pageInfo.static
? '○'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Error() {
return <p>An error has occurred</p>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function() {
return <div />
}
27 changes: 26 additions & 1 deletion test/integration/build-output/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('Build Output', () => {
})

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

Expand All @@ -83,4 +83,29 @@ describe('Build Output', () => {
expect(stdout).toContain('○ /')
})
})

describe('Custom Static Error Output', () => {
const appDir = join(fixturesDir, 'with-error-static')

beforeAll(async () => {
await remove(join(appDir, '.next'))
})

// FIXME: this should be static
xit('should specify /_error as static', async () => {
const { stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(stdout).toContain('○ /_error')
})

// This test is not really correct.
// Remove this when fixed and enable the above one.
it('should specify /_error as lambda even when static', async () => {
const { stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(stdout).toContain('λ /_error')
})
})
})