Skip to content

Commit

Permalink
fix page count on webpack 4
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Jun 11, 2021
1 parent 0954eb5 commit 4229aaf
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions test/integration/production/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,33 @@ describe('Production Usage', () => {
})

it('should contain generated page count in output', async () => {
expect(output).toContain('Generating static pages (0/38)')
expect(output).toContain('Generating static pages (38/38)')
const pageCount = process.env.NEXT_PRIVATE_TEST_WEBPACK4_MODE ? 37 : 38
expect(output).toContain(`Generating static pages (0/${pageCount})`)
expect(output).toContain(
`Generating static pages (${pageCount}/${pageCount})`
)
// we should only have 4 segments and the initial message logged out
expect(output.match(/Generating static pages/g).length).toBe(5)
})

it('should not contain currentScript usage for publicPath', async () => {
const globResult = await glob('webpack-*.js', {
cwd: join(appDir, '.next/static/chunks'),
})
if (!process.env.NEXT_PRIVATE_TEST_WEBPACK4_MODE) {
it('should not contain currentScript usage for publicPath', async () => {
const globResult = await glob('webpack-*.js', {
cwd: join(appDir, '.next/static/chunks'),
})

if (!globResult || globResult.length !== 1) {
throw new Error('could not find webpack-hash.js chunk')
}
if (!globResult || globResult.length !== 1) {
throw new Error('could not find webpack-hash.js chunk')
}

const content = await fs.readFile(
join(appDir, '.next/static/chunks', globResult[0]),
'utf8'
)
const content = await fs.readFile(
join(appDir, '.next/static/chunks', globResult[0]),
'utf8'
)

expect(content).not.toContain('.currentScript')
})
expect(content).not.toContain('.currentScript')
})
}

describe('With basic usage', () => {
it('should render the page', async () => {
Expand Down

0 comments on commit 4229aaf

Please sign in to comment.