From 574081cb87ff9cab44507a039b9ba3412edb4178 Mon Sep 17 00:00:00 2001 From: Miroslav Jonas Date: Tue, 11 Apr 2023 15:23:47 +0200 Subject: [PATCH] fix(core): fix move --- e2e/nx-misc/src/workspace.test.ts | 8 +++++--- .../src/generators/move/lib/update-jest-config.ts | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/e2e/nx-misc/src/workspace.test.ts b/e2e/nx-misc/src/workspace.test.ts index d07ec24ca1ef41..e15b3144734cd8 100644 --- a/e2e/nx-misc/src/workspace.test.ts +++ b/e2e/nx-misc/src/workspace.test.ts @@ -867,13 +867,15 @@ describe('workspace-generator', () => { const dryRunOutput = runCLI( `workspace-generator ${custom} ${workspace} --no-interactive --directory=dir --skipTsConfig=true -d` ); - expect(exists(`libs/dir/${workspace}/src/index.ts`)).toEqual(false); - expect(dryRunOutput).toContain(`CREATE libs/dir/${workspace}/src/index.ts`); + expect(exists(`packages/dir/${workspace}/src/index.ts`)).toEqual(false); + expect(dryRunOutput).toContain( + `CREATE packages/dir/${workspace}/src/index.ts` + ); runCLI( `workspace-generator ${custom} ${workspace} --no-interactive --directory=dir` ); - checkFilesExist(`libs/dir/${workspace}/src/index.ts`); + checkFilesExist(`packages/dir/${workspace}/src/index.ts`); const jsonFailing = readJson(`tools/generators/${failing}/schema.json`); jsonFailing.properties = {}; diff --git a/packages/workspace/src/generators/move/lib/update-jest-config.ts b/packages/workspace/src/generators/move/lib/update-jest-config.ts index 256134ac7e8b3e..3181aea9bc80e8 100644 --- a/packages/workspace/src/generators/move/lib/update-jest-config.ts +++ b/packages/workspace/src/generators/move/lib/update-jest-config.ts @@ -22,7 +22,11 @@ export function updateJestConfig( if (tree.exists(jestConfigPath)) { const oldContent = tree.read(jestConfigPath, 'utf-8'); - const findName = new RegExp(`'${schema.projectName}'`, 'g'); + // ensure both single and double quotes are replaced + const findName = new RegExp( + `'${schema.projectName}'|"${schema.projectName}"|\`${schema.projectName}\``, + 'g' + ); const findDir = new RegExp(project.root, 'g'); const newContent = oldContent