ng test

Runs unit tests in a project.

ng test <project> [options]ng t <project> [options]

参数

参数说明
project

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

选项

选项说明
--browsers=browsers

Override which browsers tests are run against.

--codeCoverage=true|false --codeCoverage|--noCodeCoverage

Output a code coverage report.

--codeCoverageExclude

Globs to exclude from code coverage.

--configuration=configuration
-c=configuration

A named configuration environment, as specified in the "configurations" section of angular.json.

--environment=environment

Defines the build environment.

--evalSourceMap=true|false --evalSourceMap|--noEvalSourceMap

Output in-file eval sourcemaps.

--help|--noHelp
--help=true|false|json|JSON

Shows a help message for this command in the console.

--karmaConfig=karmaConfig

The name of the Karma configuration file.

--main=main

The name of the main entry-point file.

--poll

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

--polyfills=polyfills

The name of the polyfills file.

--preserveSymlinks=true|false --preserveSymlinks|--noPreserveSymlinks

Do not use the real path when resolving modules.

--prod=true|false --prod|--noProd

When true, sets the build configuration to the production environment. All builds make use of bundling and limited tree-shaking, A production build also runs limited dead code elimination using UglifyJS.

--progress=true|false --progress|--noProgress

Log progress to the console while building.

--reporters

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

--sourceMap=true|false --sourceMap|--noSourceMap

Output sourcemaps.

--tsConfig=tsConfig

The name of the TypeScript configuration file.

--vendorSourceMap=true|false --vendorSourceMap|--noVendorSourceMap

Resolve vendor packages sourcemaps.

--watch=true|false --watch|--noWatch

Run build when files change.