Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions e2e/cli-e2e/tests/__snapshots__/help.e2e.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Commands:


Global Options:
--verbose When true creates more verbose output. This is helpful w
hen debugging. You may also set CP_VERBOSE env variable
instead. [boolean] [default: false]
--verbose Toggles whether to print debug logs. The default value i
s derived from the CP_VERBOSE environment variable (fals
e if not set). [boolean]
--config Path to config file. By default it loads code-pushup.con
fig.(ts|mjs|js). [string]
--tsconfig Path to a TypeScript config, to be used when loading con
Expand Down
2 changes: 0 additions & 2 deletions e2e/nx-plugin-e2e/tests/plugin-create-nodes.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ describe('nx-plugin', () => {
// Run CLI executor
expect(cleanStdout).toContain('DryRun execution of:');
expect(cleanStdout).toContain('npx @code-pushup/cli');
expect(cleanStdout).not.toContain('--verbose');
expect(cleanStdout).toContain('CP_VERBOSE="true"');
});

it('should consider plugin option bin in executor target', async () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ Each example is fully tested to demonstrate best practices for plugin testing as

### Global Options

| Option | Type | Default | Description |
| ---------------- | --------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **`--verbose`** | `boolean` | `false` | When true creates more verbose output. This is helpful when debugging. You may also set `CP_VERBOSE` env variable instead. |
| **`--config`** | `string` | looks for `code-pushup.config.{ts\|mjs\|js}` | Path to config file. |
| **`--tsconfig`** | `string` | n/a | Path to a TypeScript config, used to load config file. |
| Option | Type | Default | Description |
| ---------------- | --------- | ----------------------------------------------------- | ------------------------------------------------------ |
| **`--verbose`** | `boolean` | `process.env['CP_VERBOSE']` if set, otherwise `false` | Toggles whether to print debug logs. |
| **`--config`** | `string` | looks for `code-pushup.config.{ts\|mjs\|js}` | Path to config file. |
| **`--tsconfig`** | `string` | n/a | Path to a TypeScript config, used to load config file. |

> [!NOTE]
> By default, the CLI loads `code-pushup.config.(ts|mjs|js)` if no config path is provided with `--config`.
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/lib/implementation/global.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ export function yargsGlobalOptionsDefinition(): Record<
return {
verbose: {
describe:
'When true creates more verbose output. This is helpful when debugging. You may also set CP_VERBOSE env variable instead.',
'Toggles whether to print debug logs. The default value is derived from the CP_VERBOSE environment variable (false if not set).',
type: 'boolean',
default: false,
},
config: {
describe:
Expand Down
10 changes: 2 additions & 8 deletions packages/cli/src/lib/yargs-cli.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ import { options } from './options.js';
import { yargsCli } from './yargs-cli.js';

describe('yargsCli', () => {
it('should provide correct default values for global options', async () => {
const parsedArgv = await yargsCli<GlobalOptions>([], {
options,
}).parseAsync();
expect(parsedArgv.verbose).toBe(false);
});

it('should parse an empty array as a default onlyPlugins option', async () => {
const parsedArgv = await yargsCli<GlobalOptions & FilterOptions>([], {
options: { ...options, ...yargsFilterOptionsDefinition() },
Expand Down Expand Up @@ -144,7 +137,8 @@ describe('yargsCli', () => {
expect(parsedArgv).toEqual(
expect.objectContaining({
// default values
verbose: false,
onlyCategories: [],
skipCategories: [],
// overridden arguments
persist: expect.objectContaining({
outputDir: 'code-pushdown/output/dir',
Expand Down