@@ -12,6 +12,7 @@ import {runCli} from './_runCli';
1212const engine = new Engine ( ) ;
1313
1414beforeEach ( async ( ) => {
15+ // `process.env` is reset after each tests in setupTests.js.
1516 process . env . COREPACK_HOME = npath . fromPortablePath ( await xfs . mktempPromise ( ) ) ;
1617} ) ;
1718
@@ -26,15 +27,10 @@ describe(`DisableCommand`, () => {
2627 for ( const variant of getBinaryNames ( binName ) )
2728 await makeBin ( cwd , variant as Filename , { ignorePlatform : true } ) ;
2829
29- const PATH = process . env . PATH ;
30- try {
31- process . env . PATH = `${ npath . fromPortablePath ( cwd ) } ${ delimiter } ${ PATH } ` ;
32- await expect ( runCli ( cwd , [ `disable` ] ) ) . resolves . toMatchObject ( {
33- exitCode : 0 ,
34- } ) ;
35- } finally {
36- process . env . PATH = PATH ;
37- }
30+ process . env . PATH = `${ npath . fromPortablePath ( cwd ) } ${ delimiter } ${ process . env . PATH } ` ;
31+ await expect ( runCli ( cwd , [ `disable` ] ) ) . resolves . toMatchObject ( {
32+ exitCode : 0 ,
33+ } ) ;
3834
3935 const sortedEntries = xfs . readdirPromise ( cwd ) . then ( entries => {
4036 return entries . sort ( ) ;
@@ -84,15 +80,10 @@ describe(`DisableCommand`, () => {
8480 const dontRemoveBin = await makeBin ( cwd , `dont-remove` as Filename ) ;
8581 binNames . add ( ppath . basename ( dontRemoveBin ) ) ;
8682
87- const PATH = process . env . PATH ;
88- try {
89- process . env . PATH = `${ npath . fromPortablePath ( cwd ) } ${ delimiter } ${ PATH } ` ;
90- await expect ( runCli ( cwd , [ `disable` , `yarn` ] ) ) . resolves . toMatchObject ( {
91- exitCode : 0 ,
92- } ) ;
93- } finally {
94- process . env . PATH = PATH ;
95- }
83+ process . env . PATH = `${ npath . fromPortablePath ( cwd ) } ${ delimiter } ${ process . env . PATH } ` ;
84+ await expect ( runCli ( cwd , [ `disable` , `yarn` ] ) ) . resolves . toMatchObject ( {
85+ exitCode : 0 ,
86+ } ) ;
9687
9788 for ( const variant of getBinaryNames ( `yarn` ) )
9889 binNames . delete ( variant ) ;
0 commit comments