填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

ng test

Runs unit tests in a project.

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

说明

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.

参数

参数说明
<project>

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

选项

选项说明
--browsers=browsers

Override which browsers tests are run against.

--codeCoverage=true|false

Output a code coverage report.

默认值: false

--codeCoverageExclude

Globs to exclude from code coverage.

--configuration=configuration

A named build target, as specified in the "configurations" section of angular.json. Each named target is accompanied by a configuration of option defaults for that target. Setting this explicitly overrides the "--prod" flag

别名: -c

--environment=environment

Deprecated: This option has no effect.

Defines the build environment.

--evalSourceMap=true|false

Deprecated

Output in-file eval sourcemaps.

--help=
true|false|json|JSON

Shows a help message for this command in the console.

默认值: false

--include

Globs of files to include, relative to workspace or 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
--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

Do not use the real path when resolving modules.

默认值: false

--prod=true|false

Shorthand for "--configuration=production". When true, sets the build configuration to the production target. By default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.

--progress=true|false

Log progress to the console while building.

--reporters

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

--sourceMap=true|false

Output sourcemaps.

默认值: true

--tsConfig=tsConfig

The name of the TypeScript configuration file.

--vendorSourceMap=true|false

Deprecated

Resolve vendor packages sourcemaps.

默认值: false

--watch=true|false

Run build when files change.

--webWorkerTsConfig=
webWorkerTsConfig

TypeScript configuration for Web Worker modules.