1- import { DEFAULT_SETTINGS } from '../constants.js' ;
21import { type CommandContext , createCommandContext } from './context.js' ;
32
43describe ( 'createCommandContext' , ( ) => {
@@ -13,6 +12,7 @@ describe('createCommandContext', () => {
1312 directory : '/test' ,
1413 logger : console ,
1514 monorepo : false ,
15+ nxProjectsFilter : '--with-target={task}' ,
1616 output : '.code-pushup' ,
1717 projects : null ,
1818 silent : false ,
@@ -21,12 +21,10 @@ describe('createCommandContext', () => {
2121 null ,
2222 ) ,
2323 ) . toStrictEqual < CommandContext > ( {
24- project : undefined ,
2524 bin : 'npx --no-install code-pushup' ,
2625 directory : '/test' ,
2726 config : null ,
2827 silent : false ,
29- output : '.code-pushup' ,
3028 } ) ;
3129 } ) ;
3230
@@ -41,6 +39,7 @@ describe('createCommandContext', () => {
4139 directory : '/test' ,
4240 logger : console ,
4341 monorepo : false ,
42+ nxProjectsFilter : '--with-target={task}' ,
4443 output : '.code-pushup' ,
4544 projects : null ,
4645 silent : false ,
@@ -53,49 +52,10 @@ describe('createCommandContext', () => {
5352 } ,
5453 ) ,
5554 ) . toStrictEqual < CommandContext > ( {
56- project : 'ui' ,
5755 bin : 'yarn code-pushup' ,
5856 directory : '/test/ui' ,
5957 config : null ,
6058 silent : false ,
61- output : '.code-pushup' ,
6259 } ) ;
6360 } ) ;
64-
65- it ( 'should interpolate project name in output path for monorepo project' , ( ) => {
66- expect (
67- createCommandContext (
68- {
69- ...DEFAULT_SETTINGS ,
70- output : '.code-pushup/{project}' ,
71- } ,
72- {
73- name : 'website' ,
74- bin : 'npx nx run website:code-pushup --' ,
75- } ,
76- ) ,
77- ) . toEqual (
78- expect . objectContaining < Partial < CommandContext > > ( {
79- project : 'website' ,
80- bin : 'npx nx run website:code-pushup --' ,
81- output : '.code-pushup/website' ,
82- } ) ,
83- ) ;
84- } ) ;
85-
86- it ( 'should omit {project} placeholder in output path when in standalone mode' , ( ) => {
87- expect (
88- createCommandContext (
89- {
90- ...DEFAULT_SETTINGS ,
91- output : '.code-pushup/{project}' ,
92- } ,
93- undefined ,
94- ) ,
95- ) . toEqual (
96- expect . objectContaining < Partial < CommandContext > > ( {
97- output : '.code-pushup/' ,
98- } ) ,
99- ) ;
100- } ) ;
10161} ) ;
0 commit comments