import { nextTestSetup } from 'e2e-utils' import { retry } from 'next-test-utils' describe('Missing _document components error', () => { const { next } = nextTestSetup({ files: __dirname, }) async function checkMissing(missing: string[], docContent: string) { const outputIndex = next.cliOutput.length await next.patchFile('pages/_document.js', docContent) await next.render('/').catch(() => {}) await retry(async () => { const newOutput = next.cliOutput.slice(outputIndex) expect(newOutput).toContain('missing-document-component') expect(newOutput).toContain(missing.join(', ')) }) await next.deleteFile('pages/_document.js') } it('should detect missing Html component', async () => { await checkMissing( ['
'], ` import Document, { Head, Main, NextScript } from 'next/document' class MyDocument extends Document { render() { return (