@@ -265,7 +265,7 @@ if (isWindows) {
265265 t . is ( stdoutSync . toLowerCase ( ) , pathExecutable . toLowerCase ( ) ) ;
266266 } ) ;
267267
268- test . serial ( 'Uses the resolved batch file with NoDefaultCurrentDirectoryInExePath ' , async t => {
268+ test . serial ( 'Uses the resolved batch file when current-directory search is disabled ' , async t => {
269269 const binaryDirectory = path . join ( FIXTURES_DIRECTORY , 'node_modules' , '.bin' ) ;
270270 await mkdir ( binaryDirectory , { recursive : true } ) ;
271271 const command = 'batch-current-directory' ;
@@ -278,7 +278,7 @@ if (isWindows) {
278278
279279 const environmentName = 'NoDefaultCurrentDirectoryInExePath' ;
280280 const originalValue = process . env [ environmentName ] ;
281- process . env [ environmentName ] = '1' ;
281+ delete process . env [ environmentName ] ;
282282 t . teardown ( async ( ) => {
283283 if ( originalValue === undefined ) {
284284 delete process . env [ environmentName ] ;
@@ -295,13 +295,22 @@ if (isWindows) {
295295 env : {
296296 Path : binaryDirectory ,
297297 PathExt : '.CMD' ,
298+ [ environmentName ] : '1' ,
298299 } ,
299300 } ;
300301 const { stdout} = await execa ( command , options ) ;
301302 t . is ( stdout , 'PATH' ) ;
302303
303304 const { stdout : stdoutSync } = execaSync ( command , options ) ;
304305 t . is ( stdoutSync , 'PATH' ) ;
306+
307+ delete options . env [ environmentName ] ;
308+ process . env [ environmentName ] = '1' ;
309+ const { stdout : parentEnvironmentStdout } = await execa ( command , options ) ;
310+ t . is ( parentEnvironmentStdout , 'PATH' ) ;
311+
312+ const { stdout : parentEnvironmentStdoutSync } = execaSync ( command , options ) ;
313+ t . is ( parentEnvironmentStdoutSync , 'PATH' ) ;
305314 } ) ;
306315
307316 test ( 'Does not search PATH for drive-relative commands' , async t => {
0 commit comments