Skip to content

Commit 4da02ca

Browse files
committed
fix(@angular/build): enable unit-test builder watch outside CI
When using the experimental `unit-test` builder, the `watch` option will now default to true when there is an interactive terminal and not on CI. This more closely aligns with the behavior of the existing `karma` builder and that of vitest itself. CI is determined by the presence of a truthy `CI` environment variable.
1 parent 400a4bf commit 4da02ca

File tree

1 file changed

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

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { type BuilderContext, targetFromTargetString } from '@angular-devkit/arc
1010
import path from 'node:path';
1111
import { normalizeCacheOptions } from '../../utils/normalize-cache';
1212
import { getProjectRootPaths } from '../../utils/project-metadata';
13+
import { isTTY } from '../../utils/tty';
1314
import type { Schema as UnitTestOptions } from './schema';
1415

1516
export type NormalizedUnitTestOptions = Awaited<ReturnType<typeof normalizeOptions>>;
@@ -32,8 +33,7 @@ export async function normalizeOptions(
3233
const buildTargetSpecifier = options.buildTarget ?? `::development`;
3334
const buildTarget = targetFromTargetString(buildTargetSpecifier, projectName, 'build');
3435

35-
const { codeCoverage, codeCoverageExclude, tsConfig, runner, reporters, browsers, watch } =
36-
options;
36+
const { codeCoverage, codeCoverageExclude, tsConfig, runner, reporters, browsers } = options;
3737

3838
return {
3939
// Project/workspace information
@@ -51,7 +51,7 @@ export async function normalizeOptions(
5151
tsConfig,
5252
reporters,
5353
browsers,
54-
watch,
54+
watch: options.watch ?? isTTY(),
5555
debug: options.debug ?? false,
5656
providersFile: options.providersFile && path.join(workspaceRoot, options.providersFile),
5757
};

0 commit comments

Comments
 (0)