@@ -46,18 +46,22 @@ describe('CLI collect', () => {
4646 /* eslint-enable @typescript-eslint/no-unused-vars */
4747
4848 beforeEach ( async ( ) => {
49- await cleanTestFolder ( 'tmp/e2e' ) ;
49+ await cleanTestFolder ( 'tmp/e2e/react-todos-app ' ) ;
5050 } ) ;
5151
5252 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+ ] ,
5661 cwd : 'examples/react-todos-app' ,
5762 } ) ;
5863
5964 expect ( code ) . toBe ( 0 ) ;
60- expect ( stderr ) . toBe ( '' ) ;
6165
6266 const report = await readJsonFile ( 'tmp/e2e/react-todos-app/report.json' ) ;
6367
@@ -82,9 +86,10 @@ describe('CLI collect', () => {
8286 'code-pushup.config.ts' ,
8387 ) ;
8488
85- const { code, stderr } = await executeProcess ( {
86- command : 'code-pushup ' ,
89+ const { code } = await executeProcess ( {
90+ command : 'npx ' ,
8791 args : [
92+ '@code-pushup/cli' ,
8893 'collect' ,
8994 '--no-progress' ,
9095 `--config=${ configPath } ` ,
@@ -94,7 +99,6 @@ describe('CLI collect', () => {
9499 } ) ;
95100
96101 expect ( code ) . toBe ( 0 ) ;
97- expect ( stderr ) . toBe ( '' ) ;
98102
99103 const report = await readJsonFile ( join ( 'tmp' , 'e2e' , 'report.json' ) ) ;
100104
@@ -103,14 +107,18 @@ describe('CLI collect', () => {
103107 } ) ;
104108
105109 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+ ] ,
109118 cwd : 'examples/react-todos-app' ,
110119 } ) ;
111120
112121 expect ( code ) . toBe ( 0 ) ;
113- expect ( stderr ) . toBe ( '' ) ;
114122
115123 const report = await readJsonFile ( 'tmp/e2e/react-todos-app/report.json' ) ;
116124
@@ -119,30 +127,37 @@ describe('CLI collect', () => {
119127 } ) ;
120128
121129 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+ ] ,
125138 cwd : 'examples/react-todos-app' ,
126139 } ) ;
127140
128141 expect ( code ) . toBe ( 0 ) ;
129- expect ( stderr ) . toBe ( '' ) ;
130142
131143 const report = await readJsonFile ( 'tmp/e2e/react-todos-app/report.json' ) ;
132144 expect ( ( ) => reportSchema . parse ( report ) ) . not . toThrow ( ) ;
133145 expect ( omitVariableReportData ( report as Report ) ) . toMatchSnapshot ( ) ;
134146 } ) ;
135147
136148 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+ ] ,
140157 cwd : 'examples/react-todos-app' ,
141158 } ) ;
142159
143160 expect ( code ) . toBe ( 0 ) ;
144- expect ( stderr ) . toBe ( '' ) ;
145-
146161 const md = await readTextFile ( 'tmp/e2e/react-todos-app/report.md' ) ;
147162
148163 expect ( md ) . toContain ( '# Code PushUp Report' ) ;
@@ -151,14 +166,13 @@ describe('CLI collect', () => {
151166 } ) ;
152167
153168 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' ] ,
157172 cwd : 'examples/react-todos-app' ,
158173 } ) ;
159174
160175 expect ( code ) . toBe ( 0 ) ;
161- expect ( stderr ) . toBe ( '' ) ;
162176
163177 expect ( stdout ) . toContain ( 'Code PushUp Report' ) ;
164178 expect ( stdout ) . not . toContain ( 'Generated reports' ) ;
0 commit comments