1
- import { DEFAULT_SETTINGS } from '../constants.js' ;
2
1
import { type CommandContext , createCommandContext } from './context.js' ;
3
2
4
3
describe ( 'createCommandContext' , ( ) => {
@@ -13,6 +12,7 @@ describe('createCommandContext', () => {
13
12
directory : '/test' ,
14
13
logger : console ,
15
14
monorepo : false ,
15
+ nxProjectsFilter : '--with-target={task}' ,
16
16
output : '.code-pushup' ,
17
17
projects : null ,
18
18
silent : false ,
@@ -21,12 +21,10 @@ describe('createCommandContext', () => {
21
21
null ,
22
22
) ,
23
23
) . toStrictEqual < CommandContext > ( {
24
- project : undefined ,
25
24
bin : 'npx --no-install code-pushup' ,
26
25
directory : '/test' ,
27
26
config : null ,
28
27
silent : false ,
29
- output : '.code-pushup' ,
30
28
} ) ;
31
29
} ) ;
32
30
@@ -41,6 +39,7 @@ describe('createCommandContext', () => {
41
39
directory : '/test' ,
42
40
logger : console ,
43
41
monorepo : false ,
42
+ nxProjectsFilter : '--with-target={task}' ,
44
43
output : '.code-pushup' ,
45
44
projects : null ,
46
45
silent : false ,
@@ -53,49 +52,10 @@ describe('createCommandContext', () => {
53
52
} ,
54
53
) ,
55
54
) . toStrictEqual < CommandContext > ( {
56
- project : 'ui' ,
57
55
bin : 'yarn code-pushup' ,
58
56
directory : '/test/ui' ,
59
57
config : null ,
60
58
silent : false ,
61
- output : '.code-pushup' ,
62
59
} ) ;
63
60
} ) ;
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
- } ) ;
101
61
} ) ;
0 commit comments