@@ -80,9 +80,10 @@ describe(`DisableCommand`, () => {
8080 const dontRemoveBin = await makeBin ( cwd , `dont-remove` as Filename ) ;
8181 binNames . add ( ppath . basename ( dontRemoveBin ) ) ;
8282
83- process . env . PATH = `${ npath . fromPortablePath ( cwd ) } ${ delimiter } ${ process . env . PATH } ` ;
84- await expect ( runCli ( cwd , [ `disable` , `yarn` ] ) ) . resolves . toMatchObject ( {
83+ await expect ( runCli ( cwd , [ `disable` , `--install-directory=${ npath . fromPortablePath ( cwd ) } ` , `yarn` ] ) ) . resolves . toMatchObject ( {
8584 exitCode : 0 ,
85+ stdout : `` ,
86+ stderr : `` ,
8687 } ) ;
8788
8889 for ( const variant of getBinaryNames ( `yarn` ) )
@@ -103,17 +104,23 @@ describe(`DisableCommand`, () => {
103104 await xfs . mkdirPromise ( ppath . join ( cwd , `switch/bin` ) , { recursive : true } ) ;
104105 await xfs . writeFilePromise ( ppath . join ( cwd , `switch/bin/yarn` ) , `hello` ) ;
105106
106- await xfs . linkPromise (
107+ await xfs . symlinkPromise (
107108 ppath . join ( cwd , `switch/bin/yarn` ) ,
108109 ppath . join ( cwd , `yarn` ) ,
109110 ) ;
110111
111- await expect ( runCli ( cwd , [ `disable` ] ) ) . resolves . toMatchObject ( {
112+ const isWindows = process . platform === `win32` ; // Yarn Switch support is Posix-only
113+ await expect ( runCli ( cwd , [ `disable` , `--install-directory=${ npath . fromPortablePath ( cwd ) } ` ] ) ) . resolves . toMatchObject ( {
114+ stdout : `` ,
115+ stderr : isWindows ? `` : expect . stringMatching ( / ^ y a r n i s a l r e a d y i n s t a l l e d i n .+ a n d p o i n t s t o a Y a r n S w i t c h i n s t a l l - s k i p p i n g \n $ / ) ,
112116 exitCode : 0 ,
113117 } ) ;
114118
115- const file = await xfs . readFilePromise ( ppath . join ( cwd , `yarn` ) , `utf8` ) ;
116- expect ( file ) . toBe ( `hello` ) ;
119+ if ( isWindows ) {
120+ expect ( xfs . existsSync ( ppath . join ( cwd , `yarn` ) ) ) . toBe ( false ) ;
121+ } else {
122+ await expect ( xfs . readFilePromise ( ppath . join ( cwd , `yarn` ) , `utf8` ) ) . resolves . toBe ( `hello` ) ;
123+ }
117124 } ) ;
118125 } ) ;
119126} ) ;
0 commit comments