From 1036a04ea8d08511e03f2965d65ec1fd3abb4320 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 22 Aug 2022 13:44:33 +0200 Subject: [PATCH] e2e-test: update yarnrc logic Signed-off-by: Patrik Oldsberg --- packages/e2e-test/src/commands/run.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/e2e-test/src/commands/run.ts b/packages/e2e-test/src/commands/run.ts index d324aeafaf..fcca2ee7f2 100644 --- a/packages/e2e-test/src/commands/run.ts +++ b/packages/e2e-test/src/commands/run.ts @@ -183,20 +183,23 @@ async function buildDistWorkspace(workspaceName: string, rootDir: string) { * Pin the yarn version in a directory to the one we're using in the Backstage repo */ async function pinYarnVersion(dir: string) { - const yarnRc = await fs.readFile(paths.resolveOwnRoot('.yarnrc'), 'utf8'); + const yarnRc = await fs.readFile(paths.resolveOwnRoot('.yarnrc.yml'), 'utf8'); const yarnRcLines = yarnRc.split('\n'); - const yarnPathLine = yarnRcLines.find(line => line.startsWith('yarn-path')); + const yarnPathLine = yarnRcLines.find(line => line.startsWith('yarnPath:')); if (!yarnPathLine) { - throw new Error(`Unable to find 'yarn-path' in ${yarnRc}`); + throw new Error(`Unable to find 'yarnPath' in ${yarnRc}`); } - const match = yarnPathLine.match(/"(.*)"/); + const match = yarnPathLine.match(/^yarnPath: (.*)$/); if (!match) { - throw new Error(`Invalid 'yarn-path' in ${yarnRc}`); + throw new Error(`Invalid 'yarnPath' in ${yarnRc}`); } const [, localYarnPath] = match; const yarnPath = paths.resolveOwnRoot(localYarnPath); - await fs.writeFile(resolvePath(dir, '.yarnrc'), `yarn-path "${yarnPath}"\n`); + await fs.writeFile( + resolvePath(dir, '.yarnrc.yml'), + `yarnPath: ${yarnPath}\n`, + ); } /**