Skip to content

Commit

Permalink
Merge branch 'canary' into example-yarn-workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Sep 21, 2020
2 parents 32a947f + 4adf48b commit fd70646
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/next/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function divideSegments(number: number, segments: number): number[] {
return result
}

const createProgress = (total: number, label = 'Exporting') => {
const createProgress = (total: number, label: string) => {
const segments = divideSegments(total, 4)

let currentSegmentTotal = segments.shift()
Expand Down Expand Up @@ -381,7 +381,7 @@ export default async function exportApp(
!options.silent &&
createProgress(
filteredPaths.length,
`${Log.prefixes.info} ${options.statusMessage}`
`${Log.prefixes.info} ${options.statusMessage || 'Exporting'}`
)
const pagesDataDir = options.buildExport
? outDir
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => <p>I am a home page</p>
36 changes: 36 additions & 0 deletions test/integration/export-progress-status-message/test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* eslint-env jest */

import { join } from 'path'
import { nextBuild, nextExportDefault } from 'next-test-utils'

jest.setTimeout(1000 * 60 * 5)
const appDir = join(__dirname, '../')

describe('Export cli prints progress info', () => {
let buildStdout
let exportStdout
beforeAll(async () => {
const buildResult = await nextBuild(appDir, [], { stdout: true })
buildStdout = buildResult.stdout
const exportResult = await nextExportDefault(appDir, { stdout: true })
exportStdout = exportResult.stdout
})

it('build: should log with internally passed statusMessage', async () => {
const lines = buildStdout.split('\n')
// Search `info - Generating static pages (n/m)` line
const found = lines.some((line) =>
/Generating static pages \(\d+\/\d+\)/.test(line)
)

expect(found).toBeTruthy()
})

it('export: should log with default label', async () => {
const lines = exportStdout.split('\n')
// Search `info - Exporting (n/m)` line
const found = lines.some((line) => /Exporting \(\d+\/\d+\)/.test(line))

expect(found).toBeTruthy()
})
})

0 comments on commit fd70646

Please sign in to comment.