Skip to content

Commit 5e960ce

Browse files
alan-agius4dgp1130
authored andcommitted
fix(@angular-devkit/build-angular): fix incorrect glob cwd in karma when using --include option
Previously, we amended the project source root to the source root which resulted in an invalid path. Closes #23396 (cherry picked from commit 6677994)
1 parent 1b5e920 commit 5e960ce

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

packages/angular_devkit/build_angular/src/builders/karma/index.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,8 @@ export function execute(
118118
}
119119

120120
const projectMetadata = await context.getProjectMetadata(projectName);
121-
const projectRoot = path.join(
122-
context.workspaceRoot,
123-
(projectMetadata.root as string | undefined) ?? '',
124-
);
125-
const projectSourceRoot = path.join(
126-
projectRoot,
127-
(projectMetadata.sourceRoot as string | undefined) ?? '',
128-
);
121+
const sourceRoot = (projectMetadata.sourceRoot ?? projectMetadata.root ?? '') as string;
122+
const projectSourceRoot = path.join(context.workspaceRoot, sourceRoot);
129123

130124
const files = await findTests(options.include, context.workspaceRoot, projectSourceRoot);
131125
// early exit, no reason to start karma
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { ng } from '../../utils/process';
2+
3+
export default async function () {
4+
await ng('test', '--no-watch', `--include='**/*.spec.ts'`);
5+
}

0 commit comments

Comments
 (0)