Karma JS Reporter
send JSON results of a karma test to a callback function
Usage
karma.conf.js
// previous configuration ...
reporters: ['js'],
jsReporter: function(testResults){
// do something with testResults here
}
// if following set in config check for a11y tests is performed based on: https://open-wc.org/testing/testing-chai-a11y-axe.html
client: {
mocha: {
expose: ['body'],
},
}
// ... more configuration
Example output
{
"stats": {
"success": 11,
"failed": 0,
"error": false,
"disconnected": false,
"exitCode": 0
},
"pending": [],
"failures": [],
"successes": [
{
"title": "should be a function",
"description": "each should be a function",
"duration": 0,
"a11y": []
},
{
"title": "should not return anything",
"description": "each should not return anything",
"duration": 0,
"a11y": null
},
{
"title": "provide access to each value",
"description": "each should iterate over arrays and provide access to each value",
"duration": 1,
"a11y": [
"aria-valid-attr-value"
]
},
{
"title": "provide access to each index",
"description": "each should iterate over arrays and provide access to each index",
"duration": 0
},
{
"title": "provide access to the original collection",
"description": "each should iterate over arrays and provide access to the original collection",
"duration": 0
},
{
"title": "only iterate over numeric keys of an array, not all properties",
"description": "each should iterate over arrays and only iterate over numeric keys of an array, not all properties",
"duration": 1
},
{
"title": "not use the native Array.prototype.forEach",
"description": "each should iterate over arrays and not use the native Array.prototype.forEach",
"duration": 1
},
{
"title": "provide access to each value",
"description": "each should iterate over objects and provide access to each value",
"duration": 0
},
{
"title": "provide access to each key",
"description": "each should iterate over objects and provide access to each key",
"duration": 0
},
{
"title": "provide access to the original object",
"description": "each should iterate over objects and provide access to the original object",
"duration": 0
},
{
"title": "not confuse an object with a `length` property for an array",
"description": "each should iterate over objects and not confuse an object with a `length` property for an array",
"duration": 0
}
]
}