File tree Expand file tree Collapse file tree 4 files changed +28
-17
lines changed
e2e/cli-e2e/tests/__snapshots__
testing/test-setup/src/lib Expand file tree Collapse file tree 4 files changed +28
-17
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ Global Options:
2121 --progress Show progress bar in stdout.
2222 [boolean] [default: true]
2323 --verbose When true creates more verbose output. This is helpful w
24- hen debugging. [boolean] [default: false]
24+ hen debugging. You may also set CP_VERBOSE env variable
25+ instead. [boolean] [default: false]
2526 --config Path to config file. By default it loads code-pushup.con
2627 fig.(ts|mjs|js). [string]
2728 --tsconfig Path to a TypeScript config, to be used when loading con
@@ -65,9 +66,9 @@ Examples:
6566 code-pushup collect --onlyPlugins=covera Run collect with only coverage plugi
6667 ge n, other plugins from config file wi
6768 ll be skipped.
68- code-pushup collect --skipPlugins=covera Run collect skiping the coverage plu
69- ge gin , other plugins from config file
70- will be included.
69+ code-pushup collect --skipPlugins=covera Run collect skipping the coverage pl
70+ ge ugin , other plugins from config file
71+ will be included.
7172 code-pushup upload --persist.outputDir=d Upload dist/report.json to portal us
7273 ist --upload.apiKey=$CP_API_KEY ing API key from environment variabl
7374 e
Original file line number Diff line number Diff line change @@ -195,12 +195,12 @@ Each example is fully tested to demonstrate best practices for plugin testing as
195195
196196# ## Global Options
197197
198- | Option | Type | Default | Description |
199- | ---------------- | --------- | -------------------------------------------- | ---------------------------------------------------------------------- |
200- | **`--progress`** | `boolean` | `true` | Show progress bar in stdout. |
201- | **`--verbose`** | `boolean` | `false` | When true creates more verbose output. This is helpful when debugging. |
202- | **`--config`** | `string` | looks for `code-pushup.config.{ts\|mjs\|js}` | Path to config file. |
203- | **`--tsconfig`** | `string` | n/a | Path to a TypeScript config, used to load config file. |
198+ | Option | Type | Default | Description |
199+ | ---------------- | --------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
200+ | **`--progress`** | `boolean` | `true` | Show progress bar in stdout. |
201+ | **`--verbose`** | `boolean` | `false` | When true creates more verbose output. This is helpful when debugging. You may also set `CP_VERBOSE` env variable instead. |
202+ | **`--config`** | `string` | looks for `code-pushup.config.{ts\|mjs\|js}` | Path to config file. |
203+ | **`--tsconfig`** | `string` | n/a | Path to a TypeScript config, used to load config file. |
204204
205205> [!NOTE]
206206> By default, the CLI loads `code-pushup.config.(ts|mjs|js)` if no config path is provided with `--config`.
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export const cli = (args: string[]) =>
2525 ] ,
2626 [
2727 'code-pushup collect --skipPlugins=coverage' ,
28- 'Run collect skiping the coverage plugin, other plugins from config file will be included.' ,
28+ 'Run collect skipping the coverage plugin, other plugins from config file will be included.' ,
2929 ] ,
3030 [
3131 'code-pushup upload --persist.outputDir=dist --upload.apiKey=$CP_API_KEY' ,
Original file line number Diff line number Diff line change 11import { logger } from '@nx/devkit' ;
22import { bold } from 'ansis' ;
3- import { mkdir , rm } from 'node:fs/promises' ;
4-
5- export async function setupTestFolder ( dirName : string ) {
6- await mkdir ( dirName , { recursive : true } ) ;
7- }
3+ import { mkdir , rm , stat } from 'node:fs/promises' ;
84
95export async function cleanTestFolder ( dirName : string ) {
10- await rm ( dirName , { recursive : true , force : true } ) ;
6+ await teardownTestFolder ( dirName ) ;
117 await mkdir ( dirName , { recursive : true } ) ;
128}
139
1410export async function teardownTestFolder ( dirName : string ) {
11+ try {
12+ const stats = await stat ( dirName ) ;
13+ if ( ! stats . isDirectory ( ) ) {
14+ logger . warn (
15+ `⚠️ You are trying to delete single file instead of directory ${ bold (
16+ dirName ,
17+ ) } .`,
18+ ) ;
19+ }
20+ } catch {
21+ // continue safely without deleting as folder does not exist in the filesystem
22+ return ;
23+ }
24+
1525 try {
1626 await rm ( dirName , {
1727 recursive : true ,
You can’t perform that action at this time.
0 commit comments