https://github.com/akullpp/karma-cucumber-reporter
Transforms Karma test output to Cucumber format which can be postprocessed by cucumber-reporting.
https://github.com/akullpp/karma-cucumber-reporter
Last synced: about 1 year ago
JSON representation
Transforms Karma test output to Cucumber format which can be postprocessed by cucumber-reporting.
- Host: GitHub
- URL: https://github.com/akullpp/karma-cucumber-reporter
- Owner: akullpp
- License: mit
- Created: 2016-08-04T15:01:37.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-02-12T10:34:05.000Z (over 6 years ago)
- Last Synced: 2024-10-31T10:51:41.067Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 872 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Karma Cucumber Reporter
Transforms Karma test output to Cucumber format which can be postprocessed by [cucumber-reporting](https://github.com/damianszczepanik/cucumber-reporting).
## Installation
```
npm i -D karma-cucumber-reporter
```
## Usage
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 () { //... });
});
```
1. The test is only included if the `PREFIX` string matches with the `prefix` option.
2. There always have to be at least one scenario, i.e. an inner `describe` block.
## Configuration
```
// 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'),
],
```
## Options
### out
**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'
}
});
};
```
### prefix
**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'
}
});
};
```
## Example
For an example, please have a look at the [examples](examples/) folder. It will produce a report like this when you run `npm test`:
