Skip to content

Commit

Permalink
fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Dec 9, 2022
1 parent 9d97a1e commit 0729e2e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next/build/analysis/get-page-static-info.ts
Expand Up @@ -316,7 +316,7 @@ export async function getPageStaticInfo(params: {
)
} else {
Log.error(
`Provided runtime "${config.runtime}" is not supported. Please leave it empty or choose one of: ${options}`
`Provided runtime "${resolvedRuntime}" is not supported. Please leave it empty or choose one of: ${options}`
)
}
if (!isDev) {
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/switchable-runtime/app/app-invalid-runtime/page.js
@@ -0,0 +1,3 @@
export default function Page() {
return <p>Hello from app</p>
}
28 changes: 28 additions & 0 deletions test/e2e/switchable-runtime/index.test.ts
Expand Up @@ -469,6 +469,34 @@ describe('Switchable runtime', () => {
/Hello from page without errors/
)
})

it('should give proper errors for invalid runtime in app dir', async () => {
// Invalid runtime
await next.patchFile(
'app/app-invalid-runtime/page.js',
`
export default function Page() {
return <p>Hello from app</p>
}
export const runtime = 'invalid-runtime'
`
)
await check(
() => renderViaHTTP(next.url, '/app-invalid-runtime'),
/Hello from app/
)
expect(next.cliOutput).toInclude(
'error - Provided runtime "invalid-runtime" is not supported. Please leave it empty or choose one of:'
)

await next.patchFile(
'app/app-invalid-runtime/page.js',
`
export default function Page() {
return <p>Hello from app</p>
}`
)
})
})
} else {
describe('Switchable runtime (prod)', () => {
Expand Down

0 comments on commit 0729e2e

Please sign in to comment.