Skip to content

Commit 1103555

Browse files
committed
Update warn -> Error and check exit code
1 parent 2faa022 commit 1103555

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

packages/next/export/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default async function({
5050
const queryWithAutoExportWarn = () => {
5151
if (hasOrigQueryValues) {
5252
throw new Error(
53-
`\nWarn: you provided query values for ${path} which is an auto-exported page. These can not be applied since the page can no longer be re-rendered on the server. To disable auto-export for this page add \`getInitialProps\`\n`
53+
`\nError: you provided query values for ${path} which is an auto-exported page. These can not be applied since the page can no longer be re-rendered on the server. To disable auto-export for this page add \`getInitialProps\`\n`
5454
)
5555
}
5656
}

test/integration/auto-export-query-error/test/index.test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ const appDir = path.join(__dirname, '..')
99
const outdir = path.join(__dirname, 'out')
1010
const nextConfig = path.join(appDir, 'next.config.js')
1111
let stderr
12+
let exitCode
1213

1314
const runTests = () => {
1415
it('should show warning for query provided for auto exported page correctly', async () => {
16+
expect(exitCode).toBe(1)
1517
expect(stderr).toContain(
16-
'Warn: you provided query values for / which is an auto-exported page. These can not be applied since the page can no longer be re-rendered on the server. To disable auto-export for this page add `getInitialProps`'
18+
'Error: you provided query values for / which is an auto-exported page. These can not be applied since the page can no longer be re-rendered on the server. To disable auto-export for this page add `getInitialProps`'
1719
)
1820

1921
expect(stderr).not.toContain('/amp')
@@ -29,12 +31,13 @@ describe('Auto Export', () => {
2931
describe('server mode', () => {
3032
beforeAll(async () => {
3133
await nextBuild(appDir)
32-
const { stderr: curStderr } = await nextExport(
34+
const { stderr: curStderr, code: curCode } = await nextExport(
3335
appDir,
3436
{ outdir },
3537
{ stderr: true }
3638
)
3739
stderr = curStderr
40+
exitCode = curCode
3841
})
3942

4043
runTests()
@@ -44,12 +47,13 @@ describe('Auto Export', () => {
4447
beforeAll(async () => {
4548
origNextConfig = await fs.readFile(nextConfig, 'utf8')
4649
await nextBuild(appDir)
47-
const { stderr: curStderr } = await nextExport(
50+
const { stderr: curStderr, code: curCode } = await nextExport(
4851
appDir,
4952
{ outdir },
5053
{ stderr: true }
5154
)
5255
stderr = curStderr
56+
exitCode = curCode
5357
})
5458
afterAll(async () => {
5559
await fs.writeFile(nextConfig, origNextConfig)

test/lib/next-test-utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ export function runNextCommand(argv, options = {}) {
111111
})
112112
}
113113

114-
instance.on('close', () => {
114+
instance.on('close', code => {
115115
resolve({
116+
code,
116117
stdout: stdoutOutput,
117118
stderr: stderrOutput,
118119
})

0 commit comments

Comments
 (0)