8bf6a87303
Follow-up to https://github.com/vercel/next.js/pull/39539 as discussed this renames to `unstable_` prefix initially while we test this out further. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
35 lines
1 KiB
TypeScript
35 lines
1 KiB
TypeScript
import { createNext } from 'e2e-utils'
|
|
import { NextInstance } from 'test/lib/next-modes/base'
|
|
|
|
describe('Edge config validations', () => {
|
|
let next: NextInstance
|
|
|
|
afterAll(() => next.destroy())
|
|
|
|
it('fails to build when unstable_allowDynamic is not a string', async () => {
|
|
next = await createNext({
|
|
skipStart: true,
|
|
files: {
|
|
'pages/index.js': `
|
|
export default function Page() {
|
|
return <p>hello world</p>
|
|
}
|
|
`,
|
|
'middleware.js': `
|
|
import { NextResponse } from 'next/server'
|
|
export default async function middleware(request) {
|
|
return NextResponse.next()
|
|
}
|
|
|
|
eval('toto')
|
|
|
|
export const config = { unstable_allowDynamic: true }
|
|
`,
|
|
},
|
|
})
|
|
await expect(next.start()).rejects.toThrow('next build failed')
|
|
expect(next.cliOutput).toMatch(
|
|
`/middleware exported 'config.unstable_allowDynamic' contains invalid pattern 'true': Expected pattern to be a non-empty string`
|
|
)
|
|
})
|
|
})
|