@@ -46,18 +46,22 @@ describe('CLI collect', () => {
46
46
/* eslint-enable @typescript-eslint/no-unused-vars */
47
47
48
48
beforeEach ( async ( ) => {
49
- await cleanTestFolder ( 'tmp/e2e' ) ;
49
+ await cleanTestFolder ( 'tmp/e2e/react-todos-app ' ) ;
50
50
} ) ;
51
51
52
52
it ( 'should run ESLint plugin and create report.json' , async ( ) => {
53
- const { code, stderr } = await executeProcess ( {
54
- command : 'code-pushup' ,
55
- args : [ 'collect' , '--no-progress' , '--onlyPlugins=eslint' ] ,
53
+ const { code } = await executeProcess ( {
54
+ command : 'npx' ,
55
+ args : [
56
+ '@code-pushup/cli' ,
57
+ 'collect' ,
58
+ '--no-progress' ,
59
+ '--onlyPlugins=eslint' ,
60
+ ] ,
56
61
cwd : 'examples/react-todos-app' ,
57
62
} ) ;
58
63
59
64
expect ( code ) . toBe ( 0 ) ;
60
- expect ( stderr ) . toBe ( '' ) ;
61
65
62
66
const report = await readJsonFile ( 'tmp/e2e/react-todos-app/report.json' ) ;
63
67
@@ -82,9 +86,10 @@ describe('CLI collect', () => {
82
86
'code-pushup.config.ts' ,
83
87
) ;
84
88
85
- const { code, stderr } = await executeProcess ( {
86
- command : 'code-pushup ' ,
89
+ const { code } = await executeProcess ( {
90
+ command : 'npx ' ,
87
91
args : [
92
+ '@code-pushup/cli' ,
88
93
'collect' ,
89
94
'--no-progress' ,
90
95
`--config=${ configPath } ` ,
@@ -94,7 +99,6 @@ describe('CLI collect', () => {
94
99
} ) ;
95
100
96
101
expect ( code ) . toBe ( 0 ) ;
97
- expect ( stderr ) . toBe ( '' ) ;
98
102
99
103
const report = await readJsonFile ( join ( 'tmp' , 'e2e' , 'report.json' ) ) ;
100
104
@@ -103,14 +107,18 @@ describe('CLI collect', () => {
103
107
} ) ;
104
108
105
109
it ( 'should run Code coverage plugin that runs coverage tool and creates report.json' , async ( ) => {
106
- const { code, stderr } = await executeProcess ( {
107
- command : 'code-pushup' ,
108
- args : [ 'collect' , '--no-progress' , '--onlyPlugins=coverage' ] ,
110
+ const { code } = await executeProcess ( {
111
+ command : 'npx' ,
112
+ args : [
113
+ '@code-pushup/cli' ,
114
+ 'collect' ,
115
+ '--no-progress' ,
116
+ '--onlyPlugins=coverage' ,
117
+ ] ,
109
118
cwd : 'examples/react-todos-app' ,
110
119
} ) ;
111
120
112
121
expect ( code ) . toBe ( 0 ) ;
113
- expect ( stderr ) . toBe ( '' ) ;
114
122
115
123
const report = await readJsonFile ( 'tmp/e2e/react-todos-app/report.json' ) ;
116
124
@@ -119,30 +127,37 @@ describe('CLI collect', () => {
119
127
} ) ;
120
128
121
129
it ( 'should run Lighthouse plugin that runs lighthouse CLI and creates report.json' , async ( ) => {
122
- const { code, stderr } = await executeProcess ( {
123
- command : 'code-pushup' ,
124
- args : [ 'collect' , '--no-progress' , '--onlyPlugins=lighthouse' ] ,
130
+ const { code } = await executeProcess ( {
131
+ command : 'npx' ,
132
+ args : [
133
+ '@code-pushup/cli' ,
134
+ 'collect' ,
135
+ '--no-progress' ,
136
+ '--onlyPlugins=lighthouse' ,
137
+ ] ,
125
138
cwd : 'examples/react-todos-app' ,
126
139
} ) ;
127
140
128
141
expect ( code ) . toBe ( 0 ) ;
129
- expect ( stderr ) . toBe ( '' ) ;
130
142
131
143
const report = await readJsonFile ( 'tmp/e2e/react-todos-app/report.json' ) ;
132
144
expect ( ( ) => reportSchema . parse ( report ) ) . not . toThrow ( ) ;
133
145
expect ( omitVariableReportData ( report as Report ) ) . toMatchSnapshot ( ) ;
134
146
} ) ;
135
147
136
148
it ( 'should create report.md' , async ( ) => {
137
- const { code, stderr } = await executeProcess ( {
138
- command : 'code-pushup' ,
139
- args : [ 'collect' , '--persist.format=md' , '--no-progress' ] ,
149
+ const { code } = await executeProcess ( {
150
+ command : 'npx' ,
151
+ args : [
152
+ '@code-pushup/cli' ,
153
+ 'collect' ,
154
+ '--persist.format=md' ,
155
+ '--no-progress' ,
156
+ ] ,
140
157
cwd : 'examples/react-todos-app' ,
141
158
} ) ;
142
159
143
160
expect ( code ) . toBe ( 0 ) ;
144
- expect ( stderr ) . toBe ( '' ) ;
145
-
146
161
const md = await readTextFile ( 'tmp/e2e/react-todos-app/report.md' ) ;
147
162
148
163
expect ( md ) . toContain ( '# Code PushUp Report' ) ;
@@ -151,14 +166,13 @@ describe('CLI collect', () => {
151
166
} ) ;
152
167
153
168
it ( 'should print report summary to stdout' , async ( ) => {
154
- const { code, stdout, stderr } = await executeProcess ( {
155
- command : 'code-pushup ' ,
156
- args : [ 'collect' , '--no-progress' ] ,
169
+ const { code, stdout } = await executeProcess ( {
170
+ command : 'npx ' ,
171
+ args : [ '@code-pushup/cli' , ' collect', '--no-progress' ] ,
157
172
cwd : 'examples/react-todos-app' ,
158
173
} ) ;
159
174
160
175
expect ( code ) . toBe ( 0 ) ;
161
- expect ( stderr ) . toBe ( '' ) ;
162
176
163
177
expect ( stdout ) . toContain ( 'Code PushUp Report' ) ;
164
178
expect ( stdout ) . not . toContain ( 'Generated reports' ) ;
0 commit comments