Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/jest/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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] = {
Expand Down