1- import { afterAll , afterEach , beforeEach , expect , vi } from 'vitest' ;
1+ import {
2+ afterAll ,
3+ afterEach ,
4+ beforeAll ,
5+ beforeEach ,
6+ describe ,
7+ expect ,
8+ it ,
9+ vi ,
10+ } from 'vitest' ;
211import { executorContext } from '@code-pushup/test-nx-utils' ;
312import { MEMFS_VOLUME } from '@code-pushup/test-utils' ;
413import * as executeProcessModule from '../../internal/execute-process.js' ;
5- import runAutorunExecutor from './executor.js' ;
14+ import runCliExecutor from './executor.js' ;
615
7- describe ( 'runAutorunExecutor ' , ( ) => {
16+ describe ( 'runCliExecutor ' , ( ) => {
817 const processEnvCP = Object . fromEntries (
918 Object . entries ( process . env ) . filter ( ( [ k ] ) => k . startsWith ( 'CP_' ) ) ,
1019 ) ;
@@ -41,7 +50,7 @@ describe('runAutorunExecutor', () => {
4150 } ) ;
4251
4352 it ( 'should call executeProcess with return result' , async ( ) => {
44- const output = await runAutorunExecutor ( { } , executorContext ( 'utils' ) ) ;
53+ const output = await runCliExecutor ( { } , executorContext ( 'utils' ) ) ;
4554 expect ( output . success ) . toBe ( true ) ;
4655 expect ( output . command ) . toMatch ( 'npx @code-pushup/cli' ) ;
4756 expect ( executeProcessSpy ) . toHaveBeenCalledWith ( {
@@ -52,15 +61,16 @@ describe('runAutorunExecutor', () => {
5261 } ) ;
5362
5463 it ( 'should normalize context' , async ( ) => {
55- const output = await runAutorunExecutor (
64+ const output = await runCliExecutor (
5665 { } ,
5766 {
5867 ...executorContext ( 'utils' ) ,
5968 cwd : 'cwd-form-context' ,
6069 } ,
6170 ) ;
6271 expect ( output . success ) . toBe ( true ) ;
63- expect ( output . command ) . toMatch ( 'utils' ) ;
72+ expect ( output . command ) . toMatch ( 'npx @code-pushup/cli' ) ;
73+ expect ( output . command ) . toContain ( 'cwd-form-context' ) ;
6474 expect ( executeProcessSpy ) . toHaveBeenCalledWith ( {
6575 command : 'npx' ,
6676 args : expect . arrayContaining ( [ '@code-pushup/cli' ] ) ,
@@ -69,7 +79,7 @@ describe('runAutorunExecutor', () => {
6979 } ) ;
7080
7181 it ( 'should process executorOptions' , async ( ) => {
72- const output = await runAutorunExecutor (
82+ const output = await runCliExecutor (
7383 { output : 'code-pushup.config.json' , persist : { filename : 'REPORT' } } ,
7484 executorContext ( 'testing-utils' ) ,
7585 ) ;
@@ -79,7 +89,7 @@ describe('runAutorunExecutor', () => {
7989 } ) ;
8090
8191 it ( 'should create command from context and options if no api key is set' , async ( ) => {
82- const output = await runAutorunExecutor (
92+ const output = await runCliExecutor (
8393 { persist : { filename : 'REPORT' , format : [ 'md' , 'json' ] } } ,
8494 executorContext ( 'core' ) ,
8595 ) ;
@@ -91,7 +101,7 @@ describe('runAutorunExecutor', () => {
91101
92102 it ( 'should create command from context, options and arguments if api key is set' , async ( ) => {
93103 vi . stubEnv ( 'CP_API_KEY' , 'cp_1234567' ) ;
94- const output = await runAutorunExecutor (
104+ const output = await runCliExecutor (
95105 {
96106 persist : { filename : 'REPORT' , format : [ 'md' , 'json' ] } ,
97107 upload : { project : 'CLI' } ,
@@ -107,7 +117,7 @@ describe('runAutorunExecutor', () => {
107117 } ) ;
108118
109119 it ( 'should set env var information if verbose is set' , async ( ) => {
110- const output = await runAutorunExecutor (
120+ const output = await runCliExecutor (
111121 {
112122 verbose : true ,
113123 } ,
@@ -131,8 +141,8 @@ describe('runAutorunExecutor', () => {
131141 expect ( logger . warn ) . toHaveBeenCalledTimes ( 0 ) ;
132142 } ) ;
133143
134- it ( 'should log env var in dryRun information if verbose is set' , async ( ) => {
135- const output = await runAutorunExecutor (
144+ it ( 'should log CP_VERBOSE env var in dryRun information if verbose is set' , async ( ) => {
145+ const output = await runCliExecutor (
136146 {
137147 dryRun : true ,
138148 verbose : true ,
@@ -150,7 +160,7 @@ describe('runAutorunExecutor', () => {
150160 } ) ;
151161
152162 it ( 'should log command if dryRun is set' , async ( ) => {
153- await runAutorunExecutor ( { dryRun : true } , executorContext ( 'utils' ) ) ;
163+ await runCliExecutor ( { dryRun : true } , executorContext ( 'utils' ) ) ;
154164
155165 expect ( logger . command ) . toHaveBeenCalledTimes ( 0 ) ;
156166 expect ( logger . warn ) . toHaveBeenCalledTimes ( 1 ) ;
0 commit comments