karma-json-reporter
JSON reporter for Karma
Installation
The easiest way is to keep karma-json-reporter
as a devDependency in your package.json
.
{
"devDependencies": {
"karma": "~0.10",
"karma-json-reporter": "~1.1"
}
}
You can simple do it by:
npm install karma-json-reporter --save-dev
Usage
Use it as a reporter
module.exports = function(config) {
reporters: ['json'],
jsonReporter: {
stdout: true,
outputFile: 'results.json'
}
};
Output data
{
"browsers": {
"<browser.id>": {
"id": "<same browser.id>",
"fullName": String,
"name": String,
"state": Number,
"lastResult": {
"success":Number,
"failed": Number,
"skipped": Number,
"total": Number,
"totalTime": Number,
"netTime":Number,
"error": Boolean,
"disconnected": Boolean
},
"launchId": Number
}
},
"result": {
"<browser.id>": [
{
"id": Number,
"description": String,
"suite": Array.of(String),
"success": Boolean,
"skipped": Boolean,
"time": Number,
"log": Array.of(String),
},
]
},
"summary": {
"success": Number,
"failed": Number,
"error": Boolean,
"disconnected": Boolean,
"exitCode": Number
}
}
Output exemple