Commit b5599525 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

fix

parent 79f9651b
......@@ -49,6 +49,10 @@ export const createProgress = (total: number, label: string) => {
interval: 200,
},
})
if (process.stdout.isTTY) {
// createSpinner logs the initial state, but doesn't do anything afterwards anyway.
progressSpinner = undefined
}
const run = () => {
curProgress++
......@@ -72,7 +76,7 @@ export const createProgress = (total: number, label: string) => {
const isFinished = curProgress === total
const message = `${label} (${curProgress}/${total})`
if (process.stdout.isTTY && progressSpinner && !isFinished) {
if (progressSpinner && !isFinished) {
progressSpinner.setText(message)
} else {
progressSpinner?.stop()
......@@ -87,7 +91,6 @@ export const createProgress = (total: number, label: string) => {
const clear = () => {
if (
process.stdout.isTTY &&
progressSpinner &&
// Ensure only reset and clear once to avoid set operation overflow in ora
progressSpinner.isSpinning
......
......@@ -67,11 +67,12 @@ describe('Cache Components Errors', () => {
`)
} else {
expect(output).toMatchInlineSnapshot(`
"[<timestamp>] This is a console log from a server component page
[<timestamp>] This is a console log from a server component page
[<timestamp>] Collecting build traces ...
[<timestamp>]"
`)
"[<timestamp>] This is a console log from a server component page
[<timestamp>] This is a console log from a server component page
[<timestamp>] Collecting build traces ...
[<timestamp>] ✓ Collecting build traces in 3.1s
[<timestamp>]"
`)
}
})
}
......
......@@ -51,8 +51,8 @@ describe('Polyfills', () => {
it('should contain generated page count in output', async () => {
expect(output).toContain('Generating static pages (0/5)')
expect(output).toContain('Generating static pages (5/5)')
// we should only have 1 segment and the initial message logged out
expect(output.match(/Generating static pages/g).length).toBe(5)
// we should have 4 segment, the initial message, and the final one with time
expect(output.match(/Generating static pages/g).length).toBe(6)
})
}
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment