简体   繁体   English

角度测试:无法加载记者“”,它没有注册

[英]angular cli ng test : Can not load reporter “”, it is not registered

I am trying the following command from https://cli.angular.io/reference.pdf 我正在尝试https://cli.angular.io/reference.pdf中的以下命令

ng test --reporters

The following error is showing. 显示以下错误。 Please tell me how to register reporter. 请告诉我如何注册记者。

 05 01 2017 12:47:19.437:ERROR [reporter]: Can not load reporter "", it is not re gistered! Perhaps you are missing some plugin? 05 01 2017 12:47:44.876:WARN [karma]: No captured browser, open http://localhost :9876/ 05 01 2017 12:47:44.894:INFO [karma]: Karma v1.2.0 server started at http://loca lhost:9876/ 05 01 2017 12:47:44.895:INFO [launcher]: Launching browser Chrome with unlimited concurrency 05 01 2017 12:47:44.897:ERROR [karma]: Found 1 load error 

I have able to figure out how to use reporters in angular-cli 我能够弄清楚如何在angular-cli中使用记者

I have updated the Karma configuration file (karma.conf.js) as follows 我更新了Karma配置文件(karma.conf.js),如下所示

require('karma-jasmine-html-reporter'),

and

reporters: config.angularCli && config.angularCli.codeCoverage
              ? ['progress', 'karma-remap-istanbul', 'kjhtml']
              : ['progress', 'kjhtml'],

Then run the following command to install the plugin 然后运行以下命令来安装插件

npm install karma-jasmine-html-reporter --save-dev

then I run 然后我跑了

ng test --code-coverage

It is giving me a report like this 它给我一个这样的报告 这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM