运行“业力:单位”(业力)任务WARN [记者]:无法加载“html”,它未注册!也许你错过了一些插件?

时间:2014-05-09 10:28:56

标签: html node.js angularjs reporting karma-runner

当我跑grunt test并且没有给我预期的结果时,我得到了警告,这就是编写单元测试的进度。

错误: -

Running "karma:unit" (karma) task
WARN [reporter]: Can not load "html", it is not registered!



Perhaps you are missing some plugin?

INFO [karma]: Karma v0.12.15 server started at http://localhost:8080/

INFO [launcher]: Starting browser Chrome
WARN [watcher]: Pattern "F:/AngularExamples/TestingAngular/test/mock/**/*.js" do
es not match any file.

INFO [Chrome 34.0.1847 (Windows 7)]: Connected on socket Mxn9RZeJcSW1gjL_e3d2 wi
th id 36948068
Chrome 34.0.1847 (Windows 7): Executed 1 of 1 SUCCESS (0.04 secs / 0.037 secs)

Done, without errors.

html报告插件集成在karma.config.js中: -

reporters: ['progress', 'html'],

// the default configuration
htmlReporter: {
  outputDir: 'karma_html',
  templatePath: __dirname+'/jasmine_template.html'
},

有人能指出我的原因吗?

1 个答案:

答案 0 :(得分:15)

首先,确保它已经安装 - 在运行测试的目录中的node_modules中应该有一个karma-html-reporter目录。如果没有运行:

npm install karma-html-reporter

然后确认你有“karma-html-reporter”'在插件中,即:

plugins: [
  'karma-teamcity-reporter',
  'karma-jasmine',
  'karma-coverage',
  'karma-chrome-launcher',
  'karma-phantomjs-launcher',
  'karma-html-reporter'
]