Karma 无法加载 junits 插件
Karma can't load junits plugin
我正在尝试创建一个包含我的业力测试输出的 xml 文件。我的配置如下,但我没有得到 xml 文件 + 我在某些 junits 插件上遇到错误。我该如何安装?
'use strict';
module.exports = function(config) {
config.set({
autoWatch : false,
reporters: ['progress', 'junit'],
frameworks: ['jasmine'],
browsers : ['PhantomJS'],
plugins : [
'karma-phantomjs-launcher',
'karma-jasmine'
],
junitReporter: {
outputFile: 'test-results-karma.xml',
suite: ''
}
});
};
在cmd中输出
[10:50:55] Using gulpfile C:\projects\gulpfile.js
[10:50:55] Starting 'test'...
[10:50:56] Starting Karma server...
WARN [reporter]: Can not load "junit", it is not registered!
Perhaps you are missing some plugin?
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 2.0.0 (Windows 8)]: Connected on socket fsowdSE-rhiP0UWvIvdZ wit
h id 70609702
PhantomJS 2.0.0 (Windows 8): Executed 1 of 1 SUCCESS (0.002 secs / 0.004 secs)
尝试:npm install karma-junit-reporter
{
"name": "project-template",
"version": "0.0.2",
"devDependencies": {
"grunt-contrib-less": "^0.11.4",
"grunt": "~0.4.1",
"grunt-autoprefixer": "~0.4.0",
"grunt-bower-install": "~0.7.0",
"grunt-concurrent": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-coffee": "~0.7.0",
"grunt-contrib-compass": "~0.6.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-imagemin": "~0.7.1",
"grunt-contrib-jshint": "~0.7.1",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "~0.5.2",
"grunt-file-process": "^0.2.2",
"grunt-google-cdn": "~0.2.0",
"grunt-karma": "~0.8.3",
"grunt-newer": "~0.5.4",
"grunt-ng-annotate": "^0.4.0",
"grunt-rev": "~0.1.0",
"grunt-svgmin": "~0.2.0",
"grunt-usemin": "~2.1.1",
"jshint-stylish": "~0.1.3",
"karma": "~0.12",
"karma-chrome-launcher": "~0.1.4",
"karma-jasmine": "~0.1.5",
"karma-junit-reporter": "~0.2.2",
"karma-ng-html2js-preprocessor": "~0.1",
"karma-ng-scenario": "~0.1.0",
"karma-phantomjs-launcher": "~0.1.4",
"load-grunt-tasks": "~0.2.0",
"time-grunt": "~0.2.1"
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "grunt test"
}
}
这是我的 package.json 我也在我的 karma.conf.js 中使用了 junit 记者,但不确定你到底错过了什么。
您必须在 karma.conf.js 中添加插件。
所以这看起来像:
plugins : [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-junit-reporter'
]
我正在尝试创建一个包含我的业力测试输出的 xml 文件。我的配置如下,但我没有得到 xml 文件 + 我在某些 junits 插件上遇到错误。我该如何安装?
'use strict';
module.exports = function(config) {
config.set({
autoWatch : false,
reporters: ['progress', 'junit'],
frameworks: ['jasmine'],
browsers : ['PhantomJS'],
plugins : [
'karma-phantomjs-launcher',
'karma-jasmine'
],
junitReporter: {
outputFile: 'test-results-karma.xml',
suite: ''
}
});
};
在cmd中输出
[10:50:55] Using gulpfile C:\projects\gulpfile.js
[10:50:55] Starting 'test'...
[10:50:56] Starting Karma server...
WARN [reporter]: Can not load "junit", it is not registered!
Perhaps you are missing some plugin?
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 2.0.0 (Windows 8)]: Connected on socket fsowdSE-rhiP0UWvIvdZ wit
h id 70609702
PhantomJS 2.0.0 (Windows 8): Executed 1 of 1 SUCCESS (0.002 secs / 0.004 secs)
尝试:npm install karma-junit-reporter
{
"name": "project-template",
"version": "0.0.2",
"devDependencies": {
"grunt-contrib-less": "^0.11.4",
"grunt": "~0.4.1",
"grunt-autoprefixer": "~0.4.0",
"grunt-bower-install": "~0.7.0",
"grunt-concurrent": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-coffee": "~0.7.0",
"grunt-contrib-compass": "~0.6.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-imagemin": "~0.7.1",
"grunt-contrib-jshint": "~0.7.1",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "~0.5.2",
"grunt-file-process": "^0.2.2",
"grunt-google-cdn": "~0.2.0",
"grunt-karma": "~0.8.3",
"grunt-newer": "~0.5.4",
"grunt-ng-annotate": "^0.4.0",
"grunt-rev": "~0.1.0",
"grunt-svgmin": "~0.2.0",
"grunt-usemin": "~2.1.1",
"jshint-stylish": "~0.1.3",
"karma": "~0.12",
"karma-chrome-launcher": "~0.1.4",
"karma-jasmine": "~0.1.5",
"karma-junit-reporter": "~0.2.2",
"karma-ng-html2js-preprocessor": "~0.1",
"karma-ng-scenario": "~0.1.0",
"karma-phantomjs-launcher": "~0.1.4",
"load-grunt-tasks": "~0.2.0",
"time-grunt": "~0.2.1"
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "grunt test"
}
}
这是我的 package.json 我也在我的 karma.conf.js 中使用了 junit 记者,但不确定你到底错过了什么。
您必须在 karma.conf.js 中添加插件。 所以这看起来像:
plugins : [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-junit-reporter'
]