mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
See https://github.com/vercel/next.js/pull/95553 for an explanation of why we want to split these up. TL;DR it makes CI faster and saves us some money. In CI we have to run tests at the suite/file granularity, so if a test suite is too long it limits parallelism and if it has to be retried, we have to retry the full suite.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('Lazy Module Init', () => {
|
|
const { next, isNextDev, skipped } = nextTestSetup({
|
|
files: __dirname + '/fixtures/lazy-module-init',
|
|
skipStart: true,
|
|
skipDeployment: true,
|
|
})
|
|
|
|
if (skipped) {
|
|
return
|
|
}
|
|
|
|
if (isNextDev) {
|
|
it('does not run in dev', () => {})
|
|
return
|
|
}
|
|
|
|
it('should build statically even if module scope uses sync APIs like current time and random', async () => {
|
|
try {
|
|
await next.start()
|
|
} catch {
|
|
throw new Error('expected build not to fail for fully static project')
|
|
}
|
|
|
|
expect(next.cliOutput).toContain('○ /server')
|
|
expect(next.cliOutput).toContain('○ /client')
|
|
expect(next.cliOutput).toContain('○ /client-page')
|
|
expect(next.cliOutput).toContain('◐ /[dyn]')
|
|
let $
|
|
|
|
$ = await next.render$('/server')
|
|
expect($('#id').text().length).toBeGreaterThan(0)
|
|
|
|
$ = await next.render$('/client')
|
|
expect($('#id').text().length).toBeGreaterThan(0)
|
|
|
|
$ = await next.render$('/client-page')
|
|
expect($('#id').text().length).toBeGreaterThan(0)
|
|
|
|
$ = await next.render$('/foo')
|
|
expect($('#id').text().length).toBeGreaterThan(0)
|
|
|
|
$ = await next.render$('/serial-client-sync-io')
|
|
expect($('#id').text().length).toBeGreaterThan(0)
|
|
})
|
|
})
|