it('should show error overlay when dynamic is forced',async()=>{
awaitusingsandbox=awaitcreateSandbox(
next,
newMap([
[
'app/server/page.js',
outdent`
import { cookies } from 'next/headers';
export default async function Page() {
await cookies()
return null
}
export const dynamic = "error"
`,
],
]),
'/server'
)
const{browser}=sandbox
awaitexpect(browser).toDisplayRedbox(`
{
"count": 1,
"description": "Error: Route /server with \`dynamic = "error"\` couldn't be rendered statically because it used \`cookies\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering",
// TODO(veil): Where is the stackframe for app/page.js?
awaitexpect(browser).toDisplayRedbox(`
{
"count": 1,
"description": "Error: Route / with \`dynamic = "error"\` couldn't be rendered statically because it used \`headers\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering",