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 mand line:
Cannot find plugin "karma-junit-reporter"
Can not load "junit", it is not registered
My karma.config.js:
plugins : [
'karma-jasmine',
'karma-junit-reporter',
'karma-phantomjs-launcher'
]
My 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"
}
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 mand line:
Cannot find plugin "karma-junit-reporter"
Can not load "junit", it is not registered
My karma.config.js:
plugins : [
'karma-jasmine',
'karma-junit-reporter',
'karma-phantomjs-launcher'
]
My 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"
}
Share
Improve this question
asked Jul 2, 2015 at 18:05
MattDionisMattDionis
3,62610 gold badges55 silver badges110 bronze badges
2
-
Have you run
npm install
recently? Having a package listed does not guarantee it is installed. – ssube Commented Jul 2, 2015 at 18:07 -
I don't see a line like
reporters: ['progress', 'junit']
Have you added it and does it work? – Andrew Eisenberg Commented Jul 4, 2015 at 17:53
1 Answer
Reset to default 4Making 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. 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"
}
});
};
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744747469a4591389.html
评论列表(0条)