File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ export class DisableCommand extends Command<Context> {
7272 try {
7373 const currentTarget = await fs . promises . realpath ( file ) ;
7474
75- if ( binName . includes ( `yarn` ) && currentTarget . match ( / [ / \\ ] s w i t c h [ / \\ ] / ) ) {
75+ if ( binName . includes ( `yarn` ) && currentTarget . match ( / [ / \\ ] s w i t c h [ / \\ ] b i n [ / \\ ] / ) ) {
7676 console . warn ( `${ binName } is already installed in ${ file } and points to a Yarn Switch install - skipping` ) ;
7777 return ;
7878 }
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export class EnableCommand extends Command<Context> {
8585 const currentSymlink = await fs . promises . readlink ( file ) ;
8686 const currentTarget = await fs . promises . realpath ( file ) ;
8787
88- if ( binName . includes ( `yarn` ) && currentTarget . match ( / [ / \\ ] s w i t c h [ / \\ ] / ) ) {
88+ if ( binName . includes ( `yarn` ) && currentTarget . match ( / [ / \\ ] s w i t c h [ / \\ ] b i n [ / \\ ] / ) ) {
8989 console . warn ( `${ binName } is already installed in ${ file } and points to a Yarn Switch install - skipping` ) ;
9090 return ;
9191 }
Original file line number Diff line number Diff line change @@ -100,11 +100,11 @@ describe(`DisableCommand`, () => {
100100
101101 it ( `shouldn't remove Yarn binaries if they are in a /switch/ folder` , async ( ) => {
102102 await xfs . mktempPromise ( async cwd => {
103- await xfs . mkdirPromise ( ppath . join ( cwd , `switch` ) ) ;
104- await xfs . writeFilePromise ( ppath . join ( cwd , `switch/yarn` ) , `hello` ) ;
103+ await xfs . mkdirPromise ( ppath . join ( cwd , `switch/bin` ) , { recursive : true } ) ;
104+ await xfs . writeFilePromise ( ppath . join ( cwd , `switch/bin/ yarn` ) , `hello` ) ;
105105
106106 await xfs . linkPromise (
107- ppath . join ( cwd , `switch/yarn` ) ,
107+ ppath . join ( cwd , `switch/bin/ yarn` ) ,
108108 ppath . join ( cwd , `yarn` ) ,
109109 ) ;
110110
Original file line number Diff line number Diff line change @@ -110,11 +110,11 @@ describe(`EnableCommand`, () => {
110110
111111 testNotWindows ( `shouldn't overwrite Yarn files if they are in a /switch/ folder` , async ( ) => {
112112 await xfs . mktempPromise ( async cwd => {
113- await xfs . mkdirPromise ( ppath . join ( cwd , `switch` ) ) ;
114- await xfs . writeFilePromise ( ppath . join ( cwd , `switch/yarn` ) , `hello` ) ;
113+ await xfs . mkdirPromise ( ppath . join ( cwd , `switch/bin` ) , { recursive : true } ) ;
114+ await xfs . writeFilePromise ( ppath . join ( cwd , `switch/bin/ yarn` ) , `hello` ) ;
115115
116116 await xfs . linkPromise (
117- ppath . join ( cwd , `switch/yarn` ) ,
117+ ppath . join ( cwd , `switch/bin/ yarn` ) ,
118118 ppath . join ( cwd , `yarn` ) ,
119119 ) ;
120120
You can’t perform that action at this time.
0 commit comments