1- import { Filename , ppath , xfs } from '@yarnpkg/fslib' ;
1+ import { Filename , ppath , xfs , npath } from '@yarnpkg/fslib' ;
22
3- import config from '../config.json' ;
3+ import config from '../config.json' ;
44
5- import { runCli } from './_runCli' ;
5+ import { runCli } from './_runCli' ;
66
77beforeEach ( async ( ) => {
8- process . env . COREPACK_HOME = await xfs . mktempPromise ( ) ;
8+ process . env . COREPACK_HOME = npath . fromPortablePath ( await xfs . mktempPromise ( ) ) ;
99} ) ;
1010
1111for ( const [ name , version ] of [ [ `yarn` , `1.22.4` ] , [ `yarn` , `2.0.0-rc.30` ] , [ `pnpm` , `4.11.6` ] , [ `npm` , `6.14.2` ] ] ) {
@@ -169,7 +169,7 @@ it(`should support hydrating package managers from cached archives`, async () =>
169169 } ) ;
170170
171171 // Use a new cache
172- process . env . COREPACK_HOME = await xfs . mktempPromise ( ) ;
172+ process . env . COREPACK_HOME = npath . fromPortablePath ( await xfs . mktempPromise ( ) ) ;
173173
174174 // Disable the network to make sure we don't succeed by accident
175175 process . env . COREPACK_ENABLE_NETWORK = `0` ;
@@ -193,3 +193,21 @@ it(`should support hydrating package managers from cached archives`, async () =>
193193 }
194194 } ) ;
195195} ) ;
196+
197+ it ( `should support running package managers with bin array` , async ( ) => {
198+ await xfs . mktempPromise ( async cwd => {
199+ await xfs . writeJsonPromise ( ppath . join ( cwd , `package.json` as Filename ) , {
200+ packageManager : `yarn@2.2.2` ,
201+ } ) ;
202+
203+ await expect ( runCli ( cwd , [ `yarn` , `yarnpkg` , `--version` ] ) ) . resolves . toMatchObject ( {
204+ stdout : `2.2.2\n` ,
205+ exitCode : 0 ,
206+ } ) ;
207+
208+ await expect ( runCli ( cwd , [ `yarn` , `yarn` , `--version` ] ) ) . resolves . toMatchObject ( {
209+ stdout : `2.2.2\n` ,
210+ exitCode : 0 ,
211+ } ) ;
212+ } ) ;
213+ } ) ;
0 commit comments