@@ -19,17 +19,6 @@ vi.mock('@code-pushup/core', async () => {
1919} ) ;
2020
2121describe ( 'print-config-command' , ( ) => {
22- it ( 'should log config to stdout by default' , async ( ) => {
23- await yargsCli ( [ 'print-config' ] , {
24- ...DEFAULT_CLI_CONFIGURATION ,
25- commands : [ yargsPrintConfigCommandObject ( ) ] ,
26- } ) . parseAsync ( ) ;
27-
28- expect ( logger . info ) . toHaveBeenCalledWith (
29- expect . stringContaining ( '"plugins": [' ) ,
30- ) ;
31- } ) ;
32-
3322 it ( 'should write config to file if output option is given' , async ( ) => {
3423 const outputPath = path . join ( MEMFS_VOLUME , 'config.json' ) ;
3524 await yargsCli ( [ 'print-config' , `--output=${ outputPath } ` ] , {
@@ -40,32 +29,30 @@ describe('print-config-command', () => {
4029 await expect ( readFile ( outputPath , 'utf8' ) ) . resolves . toContain (
4130 '"plugins": [' ,
4231 ) ;
43- expect ( logger . info ) . not . toHaveBeenCalledWith (
44- expect . stringContaining ( '"plugins": [' ) ,
45- ) ;
4632 expect ( logger . info ) . toHaveBeenCalledWith (
4733 `Config printed to file ${ ansis . bold ( outputPath ) } ` ,
4834 ) ;
4935 } ) ;
5036
5137 it ( 'should filter out meta arguments and kebab duplicates' , async ( ) => {
52- await yargsCli ( [ 'print-config' , '--persist.outputDir=destinationDir' ] , {
53- ...DEFAULT_CLI_CONFIGURATION ,
54- commands : [ yargsPrintConfigCommandObject ( ) ] ,
55- } ) . parseAsync ( ) ;
56-
57- expect ( logger . info ) . not . toHaveBeenCalledWith (
58- expect . stringContaining ( '"$0":' ) ,
59- ) ;
60- expect ( logger . info ) . not . toHaveBeenCalledWith (
61- expect . stringContaining ( '"_":' ) ,
62- ) ;
63-
64- expect ( logger . info ) . toHaveBeenCalledWith (
65- expect . stringContaining ( '"outputDir": "destinationDir"' ) ,
66- ) ;
67- expect ( logger . info ) . not . toHaveBeenCalledWith (
68- expect . stringContaining ( '"output-dir":' ) ,
69- ) ;
38+ const outputPath = path . join ( MEMFS_VOLUME , 'config.json' ) ;
39+ await yargsCli (
40+ [
41+ 'print-config' ,
42+ `--output=${ outputPath } ` ,
43+ '--persist.outputDir=destinationDir' ,
44+ ] ,
45+ {
46+ ...DEFAULT_CLI_CONFIGURATION ,
47+ commands : [ yargsPrintConfigCommandObject ( ) ] ,
48+ } ,
49+ ) . parseAsync ( ) ;
50+ const output = await readFile ( outputPath , 'utf8' ) ;
51+
52+ expect ( output ) . not . toContain ( '"$0":' ) ;
53+ expect ( output ) . not . toContain ( '"_":' ) ;
54+
55+ expect ( output ) . toContain ( '"outputDir": "destinationDir"' ) ;
56+ expect ( output ) . not . toContain ( '"output-dir":' ) ;
7057 } ) ;
7158} ) ;
0 commit comments