Skip to content

Commit b633c04

Browse files
committed
fix(testing): fix jest ci target names (#22858)
(cherry picked from commit 25f598f)
1 parent becd93d commit b633c04

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/jest/src/plugins/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ async function buildJestTargets(
153153
// nx-ignore-next-line
154154
})) as typeof import('jest-runtime');
155155

156-
const context = await Runtime.createContext(config.projectConfig, {
156+
const jestContext = await Runtime.createContext(config.projectConfig, {
157157
maxWorkers: 1,
158158
watchman: false,
159159
});
160160

161-
const source = new jest.SearchSource(context);
161+
const source = new jest.SearchSource(jestContext);
162162

163163
const specs = await source.getTestPaths(config.globalConfig);
164164

@@ -188,7 +188,9 @@ async function buildJestTargets(
188188
targetGroup.push(options.ciTargetName);
189189

190190
for (const testPath of testPaths) {
191-
const relativePath = normalize(relative(projectRoot, testPath));
191+
const relativePath = normalize(
192+
relative(join(context.workspaceRoot, projectRoot), testPath)
193+
);
192194
const targetName = `${options.ciTargetName}--${relativePath}`;
193195
dependsOn.push(targetName);
194196
targets[targetName] = {

0 commit comments

Comments
 (0)