From b633c0409c0af8acc182674dbef67cc855888ec1 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Thu, 18 Apr 2024 10:08:39 -0400 Subject: [PATCH] fix(testing): fix jest ci target names (#22858) (cherry picked from commit 25f598ffbe307ad8954d6cfee05a64722c9f78f7) --- packages/jest/src/plugins/plugin.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/jest/src/plugins/plugin.ts b/packages/jest/src/plugins/plugin.ts index 22b8959ac712b..642d609c614dc 100644 --- a/packages/jest/src/plugins/plugin.ts +++ b/packages/jest/src/plugins/plugin.ts @@ -153,12 +153,12 @@ async function buildJestTargets( // nx-ignore-next-line })) as typeof import('jest-runtime'); - const context = await Runtime.createContext(config.projectConfig, { + const jestContext = await Runtime.createContext(config.projectConfig, { maxWorkers: 1, watchman: false, }); - const source = new jest.SearchSource(context); + const source = new jest.SearchSource(jestContext); const specs = await source.getTestPaths(config.globalConfig); @@ -188,7 +188,9 @@ async function buildJestTargets( targetGroup.push(options.ciTargetName); for (const testPath of testPaths) { - const relativePath = normalize(relative(projectRoot, testPath)); + const relativePath = normalize( + relative(join(context.workspaceRoot, projectRoot), testPath) + ); const targetName = `${options.ciTargetName}--${relativePath}`; dependsOn.push(targetName); targets[targetName] = {