@@ -3,15 +3,13 @@ import {Filename, ppath, xfs, npath, PortablePath} from '@yarnpkg/fslib';
3
3
import process from 'node:process' ;
4
4
5
5
import config from '../config.json' ;
6
+ import * as folderUtils from '../sources/folderUtils' ;
6
7
7
8
import { runCli } from './_runCli' ;
8
9
9
- let corepackHome ! : PortablePath ;
10
10
11
11
beforeEach ( async ( ) => {
12
- corepackHome = await xfs . mktempPromise ( ) ;
13
-
14
- process . env . COREPACK_HOME = npath . fromPortablePath ( corepackHome ) ;
12
+ process . env . COREPACK_HOME = npath . fromPortablePath ( await xfs . mktempPromise ( ) ) ;
15
13
process . env . COREPACK_DEFAULT_TO_LATEST = `0` ;
16
14
} ) ;
17
15
@@ -101,7 +99,7 @@ for (const [name, version] of testedPackageManagers) {
101
99
}
102
100
103
101
it ( `should update the Known Good Release only when the major matches` , async ( ) => {
104
- await xfs . writeJsonPromise ( ppath . join ( corepackHome , `lastKnownGood.json` ) , {
102
+ await xfs . writeJsonPromise ( ppath . join ( npath . toPortablePath ( folderUtils . getCorepackHomeFolder ( ) ) , `lastKnownGood.json` ) , {
105
103
yarn : `1.0.0` ,
106
104
} ) ;
107
105
@@ -645,7 +643,7 @@ it(`should not override the package manager exit code`, async () => {
645
643
packageManager : `yarn@2.2.2` ,
646
644
} ) ;
647
645
648
- const yarnFolder = ppath . join ( corepackHome , `yarn/2.2.2` ) ;
646
+ const yarnFolder = ppath . join ( npath . toPortablePath ( folderUtils . getInstallFolder ( ) ) , `yarn/2.2.2` ) ;
649
647
await xfs . mkdirPromise ( yarnFolder , { recursive : true } ) ;
650
648
await xfs . writeJsonPromise ( ppath . join ( yarnFolder , `.corepack` ) , { } ) ;
651
649
@@ -670,7 +668,7 @@ it(`should not preserve the process.exitCode when a package manager throws`, asy
670
668
packageManager : `yarn@2.2.2` ,
671
669
} ) ;
672
670
673
- const yarnFolder = ppath . join ( corepackHome , `yarn/2.2.2` ) ;
671
+ const yarnFolder = ppath . join ( npath . toPortablePath ( folderUtils . getInstallFolder ( ) ) , `yarn/2.2.2` ) ;
674
672
await xfs . mkdirPromise ( yarnFolder , { recursive : true } ) ;
675
673
await xfs . writeJsonPromise ( ppath . join ( yarnFolder , `.corepack` ) , { } ) ;
676
674
@@ -693,7 +691,7 @@ it(`should not set the exit code after successfully launching the package manage
693
691
packageManager : `yarn@2.2.2` ,
694
692
} ) ;
695
693
696
- const yarnFolder = ppath . join ( corepackHome , `yarn/2.2.2` ) ;
694
+ const yarnFolder = ppath . join ( npath . toPortablePath ( folderUtils . getInstallFolder ( ) ) , `yarn/2.2.2` ) ;
697
695
await xfs . mkdirPromise ( yarnFolder , { recursive : true } ) ;
698
696
await xfs . writeJsonPromise ( ppath . join ( yarnFolder , `.corepack` ) , { } ) ;
699
697
@@ -719,7 +717,7 @@ it(`should support package managers in ESM format`, async () => {
719
717
packageManager : `yarn@2.2.2` ,
720
718
} ) ;
721
719
722
- const yarnFolder = ppath . join ( corepackHome , `yarn/2.2.2` ) ;
720
+ const yarnFolder = ppath . join ( npath . toPortablePath ( folderUtils . getInstallFolder ( ) ) , `yarn/2.2.2` ) ;
723
721
await xfs . mkdirPromise ( yarnFolder , { recursive : true } ) ;
724
722
await xfs . writeJsonPromise ( ppath . join ( yarnFolder , `.corepack` ) , { } ) ;
725
723
0 commit comments