@@ -10,17 +10,16 @@ import * as TypeMoq from 'typemoq';
1010import { IFileSystem } from '../../../client/common/platform/types' ;
1111import { IPathUtils } from '../../../client/common/types' ;
1212import { EnvironmentVariablesService , parseEnvFile } from '../../../client/common/variables/environment' ;
13+ import { getSearchPathEnvVarNames } from '../../../client/common/utils/exec' ;
1314
1415use ( chaiAsPromised ) ;
1516
1617type PathVar = 'Path' | 'PATH' ;
17- const PATHS = [
18- 'Path' , // Windows
19- 'PATH' , // non-Windows
20- ] ;
18+ const PATHS = getSearchPathEnvVarNames ( ) ;
2119
22- suite ( 'Environment Variables Service' , ( ) => {
20+ suite ( 'xEnvironment Variables Service' , ( ) => {
2321 const filename = 'x/y/z/.env' ;
22+ const processEnvPath = getSearchPathEnvVarNames ( ) [ 0 ] ;
2423 let pathUtils : TypeMoq . IMock < IPathUtils > ;
2524 let fs : TypeMoq . IMock < IFileSystem > ;
2625 let variablesService : EnvironmentVariablesService ;
@@ -208,7 +207,7 @@ PYTHON=${BINDIR}/python3\n\
208207 expect ( vars2 ) . to . have . property ( 'TWO' , 'TWO' , 'Incorrect value' ) ;
209208 expect ( vars2 ) . to . have . property ( 'THREE' , '3' , 'Variable not merged' ) ;
210209 expect ( vars2 ) . to . have . property ( 'PYTHONPATH' , 'PYTHONPATH' , 'Incorrect value' ) ;
211- expect ( vars2 ) . to . have . property ( pathVariable , 'PATH' , 'Incorrect value' ) ;
210+ expect ( vars2 ) . to . have . property ( processEnvPath , 'PATH' , 'Incorrect value' ) ;
212211 verifyAll ( ) ;
213212 } ) ;
214213
@@ -226,7 +225,7 @@ PYTHON=${BINDIR}/python3\n\
226225 expect ( target ) . to . have . property ( 'TWO' , 'TWO' , 'Incorrect value' ) ;
227226 expect ( target ) . to . have . property ( 'THREE' , '3' , 'Variable not merged' ) ;
228227 expect ( target ) . to . have . property ( 'PYTHONPATH' , 'PYTHONPATH' , 'Incorrect value' ) ;
229- expect ( target ) . to . have . property ( pathVariable , 'PATH' , 'Incorrect value' ) ;
228+ expect ( target ) . to . have . property ( processEnvPath , 'PATH' , 'Incorrect value' ) ;
230229 verifyAll ( ) ;
231230 } ) ;
232231 } ) ;
@@ -266,17 +265,17 @@ PYTHON=${BINDIR}/python3\n\
266265 variablesService . appendPath ( vars ) ;
267266 expect ( Object . keys ( vars ) ) . lengthOf ( 2 , 'Incorrect number of variables' ) ;
268267 expect ( vars ) . to . have . property ( 'ONE' , '1' , 'Incorrect value' ) ;
269- expect ( vars ) . to . have . property ( pathVariable , 'PATH' , 'Incorrect value' ) ;
268+ expect ( vars ) . to . have . property ( processEnvPath , 'PATH' , 'Incorrect value' ) ;
270269
271270 variablesService . appendPath ( vars , '' ) ;
272271 expect ( Object . keys ( vars ) ) . lengthOf ( 2 , 'Incorrect number of variables' ) ;
273272 expect ( vars ) . to . have . property ( 'ONE' , '1' , 'Incorrect value' ) ;
274- expect ( vars ) . to . have . property ( pathVariable , 'PATH' , 'Incorrect value' ) ;
273+ expect ( vars ) . to . have . property ( processEnvPath , 'PATH' , 'Incorrect value' ) ;
275274
276275 variablesService . appendPath ( vars , ' ' , '' ) ;
277276 expect ( Object . keys ( vars ) ) . lengthOf ( 2 , 'Incorrect number of variables' ) ;
278277 expect ( vars ) . to . have . property ( 'ONE' , '1' , 'Incorrect value' ) ;
279- expect ( vars ) . to . have . property ( pathVariable , 'PATH' , 'Incorrect value' ) ;
278+ expect ( vars ) . to . have . property ( processEnvPath , 'PATH' , 'Incorrect value' ) ;
280279
281280 verifyAll ( ) ;
282281 } ) ;
@@ -291,7 +290,11 @@ PYTHON=${BINDIR}/python3\n\
291290
292291 expect ( Object . keys ( vars ) ) . lengthOf ( 2 , 'Incorrect number of variables' ) ;
293292 expect ( vars ) . to . have . property ( 'ONE' , '1' , 'Incorrect value' ) ;
294- expect ( vars ) . to . have . property ( pathVariable , `PATH${ path . delimiter } ${ pathToAppend } ` , 'Incorrect value' ) ;
293+ expect ( vars ) . to . have . property (
294+ processEnvPath ,
295+ `PATH${ path . delimiter } ${ pathToAppend } ` ,
296+ 'Incorrect value' ,
297+ ) ;
295298 verifyAll ( ) ;
296299 } ) ;
297300 } ) ;
0 commit comments