Transforms Karma test output to Cucumber format which can be postprocessed by cucumber-reporting.
MIT License
Transforms Karma test output to Cucumber format which can be postprocessed by cucumber-reporting.
npm i -D karma-cucumber-reporter
Tests have to be written with a specific syntax to be recognized and translated correctly.
describe('PREFIX FEATURE', function () {
describe('SCENARIO A', function () { //... });
describe('SCENARIO A', function () { //... });
});
The test is only included if the PREFIX
string matches with the prefix
option.
There always have to be at least one scenario, i.e. an inner describe
block.
// karma.conf.js
module.exports = function(config) {
config.set({
reporters: ['cucumber'],
});
};
If you use multiple plugins, you have to add karma-cucumber-reporter
as well:
plugins: [
// ...
require('karma-cucumber-reporter'),
],
Type: String
File location to write to. Defaults to stdout
if not present.
// karma.conf.js
module.exports = function(config) {
config.set({
reporters: ['cucumber'],
cucumberReporter: {
out: './cucumber.json'
}
});
};
Type: String
Prefix which indicates that a test should be include in the report.
// karma.conf.js
module.exports = function(config) {
config.set({
reporters: ['cucumber'],
cucumberReporter: {
prefix: 'XYZ'
}
});
};
For an example, please have a look at the examples folder. It will produce a report like this when you run npm test
: