-
Notifications
You must be signed in to change notification settings - Fork 27.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[error overlay] missing html tags error should be blocking #75839
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Layout({ children }) { | ||
return <body>{children}</body> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
import { | ||
assertHasRedbox, | ||
assertNoRedbox, | ||
getRedboxDescription, | ||
getToastErrorCount, | ||
hasErrorToast, | ||
retry, | ||
} from 'next-test-utils' | ||
import { outdent } from 'outdent' | ||
|
||
// TODO: merge with test/development/app-dir/missing-required-html-tags/index.test.ts | ||
// once new overlay is stable | ||
describe('app-dir - missing required html tags', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should display correct error count in dev indicator', async () => { | ||
const browser = await next.browser('/') | ||
|
||
retry(async () => { | ||
expect(await hasErrorToast(browser)).toBe(true) | ||
}) | ||
// Dev indicator should show 1 error | ||
expect(await getToastErrorCount(browser)).toBe(1) | ||
|
||
await assertHasRedbox(browser) | ||
|
||
await retry(async () => { | ||
expect(await getRedboxDescription(browser)).toEqual(outdent` | ||
The following tags are missing in the Root Layout: <html>. | ||
Read more at https://nextjs.org/docs/messages/missing-root-layout-tags | ||
`) | ||
}) | ||
|
||
await next.patchFile('app/layout.js', (code) => | ||
code.replace( | ||
'return <body>{children}</body>', | ||
'return <html><body>{children}</body></html>' | ||
) | ||
) | ||
|
||
await assertNoRedbox(browser) | ||
expect(await browser.elementByCss('p').text()).toBe('hello world') | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
module.exports = { | ||
experimental: { | ||
newDevOverlay: true, | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ describe('app-dir - missing required html tags', () => { | |
) | ||
|
||
await openRedbox(browser) | ||
// TODO(NDX-768): Should show "missing tags" error | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this removed? No assertion was added that shows this was fixed. Underlying issue was also not marked as done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops messed with another task in a different pr, this one should be kept. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be restored in #75796 |
||
|
||
expect(await getRedboxDescription(browser)).toMatchInlineSnapshot(` | ||
"In HTML, <p> cannot be a child of <#document>. | ||
This will cause a hydration error." | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript already checks
switch
exhaustiveness. No need for this pattern and unused return statements: #75854