CLI

test

Command
ng test
ng t

Takes the name of the project, as specified in the projects section of the angular.json workspace configuration file. When a project name is not supplied, it will execute for all projects.

Arguments

project

The name of the project to build. Can be an application or a library.

Value Typestring

Options

aot

Run tests using Ahead of Time compilation.

Value TypebooleanDefaultfalse
browsers

Override which browsers tests are run against. Set to false to not use any browser.

Value Typestring
code-coverage

Output a code coverage report.

Value TypebooleanDefaultfalse
code-coverage-exclude

Globs to exclude from code coverage.

Value Typearray
configuration
Aliasc

One or more named builder configurations as a comma-separated list as specified in the "configurations" section in angular.json. The builder uses the named configurations to run the given target. For more information, see https://angular.dev/reference/configs/workspace-config#alternate-build-configurations.

Value Typestring
define

Defines global identifiers that will be replaced with a specified constant value when found in any JavaScript or TypeScript code including libraries. The value will be used directly. String values must be put in quotes. Identifiers within Angular metadata such as Component Decorators will not be replaced.

Value Typearray
define

Defines global identifiers that will be replaced with a specified constant value when found in any JavaScript or TypeScript code including libraries. The value will be used directly. String values must be put in quotes. Identifiers within Angular metadata such as Component Decorators will not be replaced.

Value Typestring
exclude

Globs of files to exclude, relative to the project root.

Value Typearray
external-dependencies

Exclude the listed external dependencies from being bundled into the bundle. Instead, the created bundle relies on these dependencies to be available during runtime.

Value Typearray
help

Shows a help message for this command in the console.

Value Typeboolean
include

Globs of files to include, relative to project root. There are 2 special cases:

  • when a path to directory is provided, all spec files ending ".spec.@(ts|tsx)" will be included
  • when a path to a file is provided, and a matching spec file exists it will be included instead.
Value Typearray
inline-style-language

The stylesheet language to use for the application's inline component styles.

Value TypestringDefaultcss
karma-config

The name of the Karma configuration file.

Value Typestring
main

The name of the main entry-point file.

Value Typestring
poll

Enable and define the file watching poll time period in milliseconds.

Value Typenumber
polyfills

A list of polyfills to include in the build. Can be a full path for a file, relative to the current workspace or module specifier. Example: 'zone.js'.

Value Typearray
preserve-symlinks

Do not use the real path when resolving modules. If unset then will default to true if NodeJS option --preserve-symlinks is set.

Value Typeboolean
progress

Log progress to the console while building.

Value TypebooleanDefaulttrue
reporters

Karma reporters to use. Directly passed to the karma runner.

Value Typearray
source-map

Output source maps for scripts and styles. For more information, see https://angular.dev/reference/configs/workspace-config#source-map-configuration.

Value TypebooleanDefaulttrue
ts-config

The name of the TypeScript configuration file.

Value Typestring
watch

Run build when files change.

Value Typeboolean
web-worker-ts-config

TypeScript configuration for Web Worker modules.

Value Typestring
Jump to details