Skip to content

Commit 5caa610

Browse files
committed
fix(@angular/build): normalize unit test include/exclude globs to POSIX paths
The `include` and `exclude` options for the unit test builder are passed to the test runner. Some test runners expect glob patterns with POSIX-style forward slashes (`/`) even on Windows. This change ensures that the provided paths are always converted to POSIX format before being used, preventing issues when running tests on Windows with backslash-separated paths.
1 parent 0877e4d commit 5caa610

File tree

1 file changed

+3
-2
lines changed
  • packages/angular/build/src/builders/unit-test

1 file changed

+3
-2
lines changed

packages/angular/build/src/builders/unit-test/options.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { type BuilderContext, targetFromTargetString } from '@angular-devkit/arc
1010
import { constants, promises as fs } from 'node:fs';
1111
import path from 'node:path';
1212
import { normalizeCacheOptions } from '../../utils/normalize-cache';
13+
import { toPosixPath } from '../../utils/path';
1314
import { getProjectRootPaths } from '../../utils/project-metadata';
1415
import { isTTY } from '../../utils/tty';
1516
import type { Schema as UnitTestBuilderOptions } from './schema';
@@ -92,8 +93,8 @@ export async function normalizeOptions(
9293
cacheOptions,
9394
// Target/configuration specified options
9495
buildTarget,
95-
include: options.include ?? ['**/*.spec.ts'],
96-
exclude: options.exclude,
96+
include: options.include?.map(toPosixPath) ?? ['**/*.spec.ts'],
97+
exclude: options.exclude?.map(toPosixPath),
9798
filter,
9899
runnerName: runner ?? 'vitest',
99100
coverage: {

0 commit comments

Comments
 (0)