Skip to content

Commit 9d2bea9

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

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

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: 4 additions & 2 deletions
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<
@@ -7,9 +8,10 @@ export function yargsGlobalOptionsDefinition(): Record<
78
> {
89
return {
910
progress: {
10-
describe: 'Show progress bar in stdout.',
11+
describe:
12+
'Show progress bar in stdout. Turned on by default, unless in CI environment.',
1113
type: 'boolean',
12-
default: true,
14+
default: !isCI(),
1315
},
1416
verbose: {
1517
describe:

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

Lines changed: 2 additions & 1 deletion
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 () => {

0 commit comments

Comments
 (0)