[英]karma-junit-reporter not recognized
I'm trying to run tests and produce reports using karma. 我正在尝试运行测试并使用业力生成报告。 I've installed karma-junit-reporter but keep getting the following messages on the command line: 我已经安装了karma-junit-reporter但是在命令行上不断收到以下消息:
Cannot find plugin "karma-junit-reporter"
Can not load "junit", it is not registered
My karma.config.js: 我的karma.config.js:
plugins : [
'karma-jasmine',
'karma-junit-reporter',
'karma-phantomjs-launcher'
]
My package.json: 我的package.json:
"devDependencies": {
"grunt": "0.4.5",
"grunt-cli": "0.1.13",
"grunt-env": "0.4.2",
"grunt-exec": "0.4.6",
"grunt-jasmine-node": "0.2.1",
"grunt-jasmine-node-coverage": "0.1.10",
"grunt-jscs": "1.8.0",
"grunt-karma": "0.11.2",
"jasmine-core": "2.3.4",
"jasmine-node": "1.14.3",
"jasmine-reporters": "0.4.1",
"jscs": "1.13.1",
"jshint": "2.4.4",
"karma": "0.12.37",
"karma-jasmine": "0.3.6",
"karma-junit-reporter": "0.2.2",
"karma-phantomjs-launcher": "0.2.0",
"phantomjs": "1.9.17",
"supertest": "0.9.0"
}
Making sure that you ran npm install
and that all your plugin dependencies are in your package.json like @ssube alluded to is a good place to start. 确保您运行npm install
并且所有插件依赖项都在您的package.json中,如@ssube提到的那样是一个很好的起点。 That being said, here's what worked for me: 话虽这么说,这对我有用:
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
browsers: ["PhantomJS"],
frameworks: ["jasmine-jquery" ,"jasmine"],
files: [
{
pattern: "test/**/*.html",
included: false,
served: true,
watched: true
},
"dist/latest/phone.min.js",
"node_modules/jquery/dist/jquery.js"
{
pattern: "test/functional/test/phoneTest.js",
watched: true
}
], plugins: [
"karma-jasmine-jquery",
"karma-phantomjs-launcher",
"karma-junit-reporter",
"karma-jasmine"
],
client: {
"captureConsole": true
},
phantomjsLauncher: {
// Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom)
exitOnResourceError: true
},
singleRun: true,
reporters: ['progress', 'junit'],
junitReporter: {
outputDir: "testResults",
outputFile: "FUNCTIONAL-TEST-results.xml"
}
});
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.