11import { mkdir , writeFile } from 'fs/promises' ;
22import { join } from 'path' ;
33import { getGlobalVariable , setGlobalVariable } from '../utils/env' ;
4+ import { globalYarn } from '../utils/process' ;
45
56/**
67 * Configure npm to use a unique sandboxed environment.
@@ -11,6 +12,7 @@ export default async function () {
1112 const yarnModulesPrefix = join ( tempRoot , 'yarn-global' ) ;
1213 const npmRegistry : string = getGlobalVariable ( 'package-registry' ) ;
1314 const npmrc = join ( tempRoot , '.npmrc' ) ;
15+ const yarnrc = join ( tempRoot , '.yarnrc' ) ;
1416
1517 // Configure npm to use the sandboxed npm globals and rc file
1618 // From this point onward all npm transactions use the "global" npm cache
@@ -28,11 +30,16 @@ export default async function () {
2830
2931 // Configure the registry and create the prefix directories
3032 await writeFile ( npmrc , `registry=${ npmRegistry } \nprefix=${ npmModulesPrefix } ` ) ;
33+ await writeFile ( yarnrc , `registry ${ npmRegistry } \nprefix ${ yarnModulesPrefix } ` ) ;
3134 await mkdir ( npmModulesPrefix ) ;
3235 await mkdir ( yarnModulesPrefix ) ;
3336
3437 setGlobalVariable ( 'npm-global' , npmModulesPrefix ) ;
3538 setGlobalVariable ( 'yarn-global' , yarnModulesPrefix ) ;
3639
40+ console . log ( 'YARN INFO: ' ) ;
41+ await globalYarn ( [ 'config' , 'set' , 'prefix' , '/tmp/foobar' ] ) ;
42+ await globalYarn ( [ 'global' , 'bin' ] ) ;
43+
3744 console . log ( ` Using "${ npmModulesPrefix } " as e2e test global npm cache.` ) ;
3845}
0 commit comments