fix(testing): fix jest ci target names (#22858)

This commit is contained in:
Jason Jean 2024-04-18 10:08:39 -04:00 committed by GitHub
parent 7ebd27af02
commit 25f598ffbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -153,12 +153,12 @@ async function buildJestTargets(
// nx-ignore-next-line // nx-ignore-next-line
})) as typeof import('jest-runtime'); })) as typeof import('jest-runtime');
const context = await Runtime.createContext(config.projectConfig, { const jestContext = await Runtime.createContext(config.projectConfig, {
maxWorkers: 1, maxWorkers: 1,
watchman: false, watchman: false,
}); });
const source = new jest.SearchSource(context); const source = new jest.SearchSource(jestContext);
const specs = await source.getTestPaths(config.globalConfig); const specs = await source.getTestPaths(config.globalConfig);
@ -188,7 +188,9 @@ async function buildJestTargets(
targetGroup.push(options.ciTargetName); targetGroup.push(options.ciTargetName);
for (const testPath of testPaths) { 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}`; const targetName = `${options.ciTargetName}--${relativePath}`;
dependsOn.push(targetName); dependsOn.push(targetName);
targets[targetName] = { targets[targetName] = {