()
| 19 | const appDir = join(__dirname, '../') |
| 20 | |
| 21 | function runTests() { |
| 22 | it('should render server value', async () => { |
| 23 | const html = await renderViaHTTP(appPort, '/') |
| 24 | expect(html).toMatch(/the-server-value/i) |
| 25 | }) |
| 26 | |
| 27 | it('should render dynamic server rendered values on client mount', async () => { |
| 28 | const browser = await webdriver(appPort, '/') |
| 29 | const text = await browser.elementByCss('#first-render').text() |
| 30 | |
| 31 | // Failure case is 'Index<!-- -->3<!-- --><!-- -->' |
| 32 | expect(text).toMatch( |
| 33 | /^Index<!--\/?(\$|\s)-->1(<!--\/?(\$|\s)-->)+2(<!--\/?(\$|\s)-->)+3(<!--\/?(\$|\s)-->)+4(<!--\/?(\$|\s)-->)+4$/ |
| 34 | ) |
| 35 | expect(await browser.eval('window.caughtErrors')).toBe('') |
| 36 | |
| 37 | // should not print "invalid-dynamic-suspense" warning in browser's console |
| 38 | const logs = (await browser.log()).map((log) => log.message).join('\n') |
| 39 | expect(logs).not.toContain( |
| 40 | 'https://nextjs.org/docs/messages/invalid-dynamic-suspense' |
| 41 | ) |
| 42 | }) |
| 43 | } |
| 44 | |
| 45 | describe('next/dynamic', () => { |
| 46 | ;(process.env.TURBOPACK_BUILD ? describe.skip : describe)( |
no test coverage detected