11import { type MockInstance , expect , vi } from 'vitest' ;
2+ import { executorContext } from '@code-pushup/test-nx-utils' ;
23import { osAgnosticPath } from '@code-pushup/test-utils' ;
34import type { Command } from '../internal/types.js' ;
5+ import runAutorunExecutor from './executor' ;
46import {
57 parseAutorunExecutorOnlyOptions ,
68 parseAutorunExecutorOptions ,
@@ -59,6 +61,12 @@ describe('parseAutorunExecutorOnlyOptions', () => {
5961 parseAutorunExecutorOnlyOptions ( { onlyPlugins : [ 'md' , 'json' ] } ) ,
6062 ) . toStrictEqual ( expect . objectContaining ( { onlyPlugins : [ 'md' , 'json' ] } ) ) ;
6163 } ) ;
64+
65+ it ( 'should log env variables options if given' , async ( ) => {
66+ expect (
67+ parseAutorunExecutorOnlyOptions ( { env : { TEST_ENV_VAR : '42' } } ) ,
68+ ) . toStrictEqual ( expect . objectContaining ( { env : { TEST_ENV_VAR : '42' } } ) ) ;
69+ } ) ;
6270} ) ;
6371
6472describe ( 'parseAutorunExecutorOptions' , ( ) => {
@@ -84,7 +92,7 @@ describe('parseAutorunExecutorOptions', () => {
8492 projectName,
8593 workspaceRoot : 'workspaceRoot' ,
8694 projectConfig : {
87- name : 'my-app' ,
95+ name : projectName ,
8896 root : 'root' ,
8997 } ,
9098 } ,
@@ -111,6 +119,28 @@ describe('parseAutorunExecutorOptions', () => {
111119 ) ;
112120 } ) ;
113121
122+ it ( 'should include the env options' , ( ) => {
123+ const projectName = 'my-app' ;
124+ const env = {
125+ NODE_OPTIONS : '--import tsx' ,
126+ TSX_TSCONFIG_PATH : 'tsconfig.base.json' ,
127+ } ;
128+
129+ const executorOptions = parseAutorunExecutorOptions (
130+ { env } ,
131+ {
132+ projectName,
133+ workspaceRoot : 'workspaceRoot' ,
134+ projectConfig : {
135+ name : projectName ,
136+ root : 'root' ,
137+ } ,
138+ } ,
139+ ) ;
140+
141+ expect ( executorOptions . env ) . toStrictEqual ( env ) ;
142+ } ) ;
143+
114144 it . each < Command | undefined > ( [ 'upload' , 'autorun' , undefined ] ) (
115145 'should include upload config for command %s if API key is provided' ,
116146 command => {
0 commit comments