Skip to content

Commit 7ab8e9f

Browse files
committed
test: Always use Listr's verbose renderer for tests
Allowing Listr to chose it's own renderer can cause insidious bugs. For example, bash and zsh will choose different renderers for tests, causing unpredictable outputs. 1. We don't want to show a spinner in tests 2. We want to see individual changes to titles and output lines; this is accomplished with the verbose renderer. Note that this _must_ be override-able because some functions require the `silent` renderer. See https://github.com/SamVerschueren/listr#renderer
1 parent 60e423d commit 7ab8e9f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/apollo/src/Command.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ export abstract class ProjectCommand extends Command {
225225

226226
const tasks = await generateTasks(ctx);
227227
return new Listr([...this.tasks, ...tasks], {
228+
// Use the `verbose` renderer for tests. We need this for two reasons:
229+
// 1. We don't want to show a spinner in tests
230+
// 2. We want to see individual changes to titles and output lines; this is accomplished with the
231+
// verbose renderer. Note that this _must_ be override-able because some functions require the
232+
// `silent` renderer.
233+
...(process.env.NODE_ENV === "test" && { renderer: "verbose" }),
228234
...(options && typeof options === "function" ? options(ctx) : options),
229235
// @ts-ignore This option is added by https://github.com/SamVerschueren/listr-verbose-renderer#options
230236
dateFormat: false

0 commit comments

Comments
 (0)