@@ -3,7 +3,7 @@ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statS
3
3
import * as path from 'node:path' ;
4
4
import type { PackageJson } from 'type-fest' ;
5
5
import { createTestEnvironmentBlank } from './test-environments/create-test-environment-blank' ;
6
- import { createWithLock , getPackageManager , type Logger , packageManagerInstall , setPackagerManagerConfig , setupGit } from './utilities/index' ;
6
+ import { createWithLock , getPackageManager , isYarn1 , type Logger , packageManagerInstall , setPackagerManagerConfig , setupGit , YARN_1_LATEST_VERSION } from './utilities/index' ;
7
7
import { createTestEnvironmentOtterProjectWithApp } from './test-environments/create-test-environment-otter-project' ;
8
8
import { O3rCliError } from '@o3r/schematics' ;
9
9
@@ -15,8 +15,7 @@ export type PrepareTestEnvType = 'blank' | 'o3r-project-with-app';
15
15
16
16
/**
17
17
* Retrieve the version used by yarn and setup at root level
18
- * @param rootFolderPath: path to the folder where to take the configuration from
19
- * @param rootFolderPath
18
+ * @param rootFolderPath path to the folder where to take the configuration from
20
19
*/
21
20
export function getYarnVersionFromRoot ( rootFolderPath : string ) {
22
21
const o3rPackageJson : PackageJson & { generatorDependencies ?: Record < string , string > } =
@@ -49,7 +48,7 @@ export async function prepareTestEnv(folderName: string, options?: PrepareTestEn
49
48
const cacheFolderPath = path . resolve ( globalFolderPath , 'cache' ) ;
50
49
51
50
JSON . parse ( readFileSync ( path . join ( rootFolderPath , 'packages' , '@o3r' , 'core' , 'package.json' ) ) . toString ( ) ) ;
52
- const yarnVersion : string = yarnVersionParam || getYarnVersionFromRoot ( rootFolderPath ) ;
51
+ const yarnVersion : string = yarnVersionParam || ( isYarn1 ( ) && YARN_1_LATEST_VERSION ) || getYarnVersionFromRoot ( rootFolderPath ) ;
53
52
const execAppOptions : ExecSyncOptions = {
54
53
cwd : workspacePath ,
55
54
stdio : 'inherit' ,
0 commit comments