Skip to content

Commit 7a62adf

Browse files
committed
feat(cli): disable progress bar in CI environment
1 parent f98f6f1 commit 7a62adf

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

e2e/cli-e2e/tests/__snapshots__/help.e2e.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Commands:
1919
2020
Global Options:
2121
--progress Show progress bar in stdout.
22-
[boolean] [default: true]
22+
[boolean] [default: false in CI environment, otherwise true]
2323
--verbose When true creates more verbose output. This is helpful w
2424
hen debugging. You may also set CP_VERBOSE env variable
2525
instead. [boolean] [default: false]

packages/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Each example is fully tested to demonstrate best practices for plugin testing as
197197

198198
| Option | Type | Default | Description |
199199
| ---------------- | --------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
200-
| **`--progress`** | `boolean` | `true` | Show progress bar in stdout. |
200+
| **`--progress`** | `boolean` | `false` in CI, otherwise `true` | Show progress bar in stdout. |
201201
| **`--verbose`** | `boolean` | `false` | When true creates more verbose output. This is helpful when debugging. You may also set `CP_VERBOSE` env variable instead. |
202202
| **`--config`** | `string` | looks for `code-pushup.config.{ts\|mjs\|js}` | Path to config file. |
203203
| **`--tsconfig`** | `string` | n/a | Path to a TypeScript config, used to load config file. |

packages/cli/src/lib/implementation/global.options.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Options } from 'yargs';
2+
import { isCI } from '@code-pushup/utils';
23
import type { GeneralCliOptions } from './global.model.js';
34

45
export function yargsGlobalOptionsDefinition(): Record<
@@ -9,7 +10,8 @@ export function yargsGlobalOptionsDefinition(): Record<
910
progress: {
1011
describe: 'Show progress bar in stdout.',
1112
type: 'boolean',
12-
default: true,
13+
default: !isCI(),
14+
defaultDescription: 'false in CI environment, otherwise true',
1315
},
1416
verbose: {
1517
describe:

packages/cli/src/lib/yargs-cli.int.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, expect, it } from 'vitest';
22
import type { CoreConfig, Format } from '@code-pushup/models';
3+
import { isCI } from '@code-pushup/utils';
34
import { yargsHistoryOptionsDefinition } from './history/history.options.js';
45
import type { CompareOptions } from './implementation/compare.model.js';
56
import { yargsCompareOptionsDefinition } from './implementation/compare.options.js';
@@ -21,7 +22,7 @@ describe('yargsCli', () => {
2122
options,
2223
}).parseAsync();
2324
expect(parsedArgv.verbose).toBe(false);
24-
expect(parsedArgv.progress).toBe(true);
25+
expect(parsedArgv.progress).toBe(!isCI());
2526
});
2627

2728
it('should parse an empty array as a default onlyPlugins option', async () => {
@@ -112,7 +113,6 @@ describe('yargsCli', () => {
112113
FilterOptions
113114
>(
114115
[
115-
'--verbose',
116116
'--persist.format=md',
117117
'--persist.outputDir=code-pushdown/output/dir',
118118
'--persist.filename=code-pushdown-report',
@@ -130,9 +130,8 @@ describe('yargsCli', () => {
130130
expect(parsedArgv).toEqual(
131131
expect.objectContaining({
132132
// default values
133-
progress: true,
133+
verbose: false,
134134
// overridden arguments
135-
verbose: true,
136135
persist: expect.objectContaining({
137136
outputDir: 'code-pushdown/output/dir',
138137
filename: 'code-pushdown-report',

0 commit comments

Comments
 (0)