-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25ee71f
commit a133f85
Showing
8 changed files
with
180 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/integration/build-output/fixtures/basic-app/pages/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function() { | ||
return <div /> | ||
} |
3 changes: 3 additions & 0 deletions
3
test/integration/build-output/fixtures/with-app/pages/_app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function MyApp({ Component, pageProps }) { | ||
return <Component {...pageProps} /> | ||
} |
3 changes: 3 additions & 0 deletions
3
test/integration/build-output/fixtures/with-app/pages/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function() { | ||
return <div /> | ||
} |
18 changes: 18 additions & 0 deletions
18
test/integration/build-output/fixtures/with-error/pages/_error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react' | ||
|
||
function Error({ statusCode }) { | ||
return ( | ||
<p> | ||
{statusCode | ||
? `An error ${statusCode} occurred on server` | ||
: 'An error occurred on client'} | ||
</p> | ||
) | ||
} | ||
|
||
Error.getInitialProps = ({ res, err }) => { | ||
const statusCode = res ? res.statusCode : err ? err.statusCode : 404 | ||
return { statusCode } | ||
} | ||
|
||
export default Error |
3 changes: 3 additions & 0 deletions
3
test/integration/build-output/fixtures/with-error/pages/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function() { | ||
return <div /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* eslint-env jest */ | ||
/* global jasmine */ | ||
import 'flat-map-polyfill' | ||
import { remove } from 'fs-extra' | ||
import { nextBuild } from 'next-test-utils' | ||
import { join } from 'path' | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2 | ||
|
||
const fixturesDir = join(__dirname, '..', 'fixtures') | ||
|
||
describe('Build Output', () => { | ||
describe('Basic Application Output', () => { | ||
const appDir = join(fixturesDir, 'basic-app') | ||
|
||
beforeAll(async () => { | ||
await remove(join(appDir, '.next')) | ||
}) | ||
|
||
it('should not include internal pages', async () => { | ||
const { stdout } = await nextBuild(appDir, [], { | ||
stdout: true, | ||
}) | ||
|
||
expect(stdout).not.toContain('/_document') | ||
expect(stdout).not.toContain('/_app') | ||
expect(stdout).not.toContain('/_error') | ||
|
||
expect(stdout).toContain('○ /') | ||
}) | ||
}) | ||
|
||
describe('Custom App Output', () => { | ||
const appDir = join(fixturesDir, 'with-app') | ||
|
||
beforeAll(async () => { | ||
await remove(join(appDir, '.next')) | ||
}) | ||
|
||
it('should not include internal pages', async () => { | ||
const { stdout } = await nextBuild(appDir, [], { | ||
stdout: true, | ||
}) | ||
|
||
expect(stdout).not.toContain('/_document') | ||
expect(stdout).not.toContain('/_error') | ||
|
||
expect(stdout).toContain('/_app') | ||
expect(stdout).toContain('○ /') | ||
}) | ||
}) | ||
|
||
describe('Custom Error Output', () => { | ||
const appDir = join(fixturesDir, 'with-error') | ||
|
||
beforeAll(async () => { | ||
await remove(join(appDir, '.next')) | ||
}) | ||
|
||
it('should not include internal pages', async () => { | ||
const { stdout } = await nextBuild(appDir, [], { | ||
stdout: true, | ||
}) | ||
|
||
expect(stdout).not.toContain('/_document') | ||
expect(stdout).not.toContain('/_app') | ||
|
||
expect(stdout).toContain('/_error') | ||
expect(stdout).toContain('○ /') | ||
}) | ||
}) | ||
}) |