Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): fix incorrect glob cwd in karma w…
Browse files Browse the repository at this point in the history
…hen 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)
  • Loading branch information
alan-agius4 authored and dgp1130 committed Jun 21, 2022
1 parent 1b5e920 commit 5e960ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,8 @@ export function execute(
}

const projectMetadata = await context.getProjectMetadata(projectName);
const projectRoot = path.join(
context.workspaceRoot,
(projectMetadata.root as string | undefined) ?? '',
);
const projectSourceRoot = path.join(
projectRoot,
(projectMetadata.sourceRoot as string | undefined) ?? '',
);
const sourceRoot = (projectMetadata.sourceRoot ?? projectMetadata.root ?? '') as string;
const projectSourceRoot = path.join(context.workspaceRoot, sourceRoot);

const files = await findTests(options.include, context.workspaceRoot, projectSourceRoot);
// early exit, no reason to start karma
Expand Down
5 changes: 5 additions & 0 deletions tests/legacy-cli/e2e/tests/test/test-include-glob.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ng } from '../../utils/process';

export default async function () {
await ng('test', '--no-watch', `--include='**/*.spec.ts'`);
}

0 comments on commit 5e960ce

Please sign in to comment.