@@ -11,38 +11,27 @@ import type { Operation } from '../Operation';
1111import type { ICommandLineJson } from '../../../api/CommandLineJson' ;
1212import { PhasedOperationPlugin } from '../PhasedOperationPlugin' ;
1313import { ShellOperationRunnerPlugin } from '../ShellOperationRunnerPlugin' ;
14- import { IgnoredParametersPlugin } from '../IgnoredParametersPlugin' ;
14+ import {
15+ IgnoredParametersPlugin ,
16+ RUSHSTACK_OPERATION_IGNORED_PARAMETERS_ENV_VAR
17+ } from '../IgnoredParametersPlugin' ;
1518import {
1619 type ICreateOperationsContext ,
1720 PhasedCommandHooks
1821} from '../../../pluginFramework/PhasedCommandHooks' ;
1922import { RushProjectConfiguration } from '../../../api/RushProjectConfiguration' ;
2023import type { IEnvironment } from '../../../utilities/Utilities' ;
24+ import type { IOperationRunnerContext } from '../IOperationRunner' ;
25+ import type { IOperationExecutionResult } from '../IOperationExecutionResult' ;
2126
2227/**
2328 * Helper function to create a minimal mock record for testing the createEnvironmentForOperation hook
2429 */
25- function createMockRecord ( operation : Operation ) : any {
30+ function createMockRecord ( operation : Operation ) : IOperationRunnerContext & IOperationExecutionResult {
2631 return {
2732 operation,
28- collatedWriter : { } as any ,
29- debugMode : false ,
30- quietMode : true ,
31- _operationMetadataManager : { } as any ,
32- stopwatch : { } as any ,
33- status : { } as any ,
34- environment : undefined ,
35- error : undefined ,
36- silent : false ,
37- stdioSummarizer : { } as any ,
38- problemCollector : { } as any ,
39- nonCachedDurationMs : undefined ,
40- metadataFolderPath : undefined ,
41- logFilePaths : undefined ,
42- getStateHash : ( ) => '' ,
43- getStateHashComponents : ( ) => [ ] ,
44- runWithTerminalAsync : async ( ) => { }
45- } ;
33+ environment : undefined
34+ } as IOperationRunnerContext & IOperationExecutionResult ;
4635}
4736
4837describe ( IgnoredParametersPlugin . name , ( ) => {
@@ -110,7 +99,7 @@ describe(IgnoredParametersPlugin.name, () => {
11099 const envA : IEnvironment = hooks . createEnvironmentForOperation . call ( { ...process . env } , mockRecordA ) ;
111100
112101 // Verify the environment variable is set correctly for project 'a'
113- expect ( envA . RUSHSTACK_OPERATION_IGNORED_PARAMETERS ) . toBe ( '--production' ) ;
102+ expect ( envA [ RUSHSTACK_OPERATION_IGNORED_PARAMETERS_ENV_VAR ] ) . toBe ( '--production' ) ;
114103
115104 // Test project 'b' which has parameterNamesToIgnore: ["--verbose", "--config", "--mode", "--tags"]
116105 const operationB = Array . from ( operations ) . find ( ( op ) => op . name === 'b' ) ;
@@ -121,7 +110,7 @@ describe(IgnoredParametersPlugin.name, () => {
121110 const envB : IEnvironment = hooks . createEnvironmentForOperation . call ( { ...process . env } , mockRecordB ) ;
122111
123112 // Verify the environment variable is set correctly for project 'b'
124- expect ( envB . RUSHSTACK_OPERATION_IGNORED_PARAMETERS ) . toBe ( '--verbose --config --mode --tags' ) ;
113+ expect ( envB [ RUSHSTACK_OPERATION_IGNORED_PARAMETERS_ENV_VAR ] ) . toBe ( '--verbose --config --mode --tags' ) ;
125114 } ) ;
126115
127116 it ( 'should not set environment variable when parameterNamesToIgnore is not specified' , async ( ) => {
@@ -177,6 +166,6 @@ describe(IgnoredParametersPlugin.name, () => {
177166 const env : IEnvironment = hooks . createEnvironmentForOperation . call ( { ...process . env } , mockRecord ) ;
178167
179168 // Verify the environment variable is not set
180- expect ( env . RUSHSTACK_OPERATION_IGNORED_PARAMETERS ) . toBeUndefined ( ) ;
169+ expect ( env [ RUSHSTACK_OPERATION_IGNORED_PARAMETERS_ENV_VAR ] ) . toBeUndefined ( ) ;
181170 } ) ;
182171} ) ;
0 commit comments