wdio-cucumberjs-json-reporter
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "wdio-cucumberjs-json-reporter", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A WDIO reporter that creates CucumberJS JSON files for WebdriverIO V5+", | ||
@@ -5,0 +5,0 @@ "main": "./build/reporter.js", |
@@ -18,3 +18,3 @@ # wdio-cucumberjs-json-reporter | ||
It will also add metadata about the running instance to the feature file and last but not least, it will give you the opportunity to add attachments to the JSON output. | ||
It will also add metadata about the running instance to the feature file and last but not least, it will give you the opportunity to add attachments to the JSON output. | ||
@@ -38,3 +38,3 @@ ## Installation | ||
so it will be added automatically to your `package.json` | ||
so it will automatically be added to your `package.json` | ||
@@ -111,3 +111,3 @@ Instructions on how to install `WebdriverIO` can be found [here](http://webdriver.io/guide/getstarted/install.html). | ||
> The metadata object needs to have the `cjson` prefix, otherwise it will not work! | ||
> The metadata object needs to have the `cjson` prefix, otherwise it will not work! | ||
@@ -179,1 +179,59 @@ ### Metadata values | ||
cucumberJson.attach(browser.takeScreenshot(), 'image/png'); | ||
``` | ||
## Use it with multiple-cucumber-html-reporter | ||
The previous module for WebdriverIO V4, [wdio-multiple-cucumber-html-reporter](https://github.com/wswebcreation/wdio-multiple-cucumber-html-reporter), | ||
had a build in connection with the [multiple-cucumber-html-reporter](https://github.com/wswebcreation/multiple-cucumber-html-reporter)-module. **This is not the case for this | ||
reporter** because the new setup of WebdriverIO V5 is based on a instance which doesn't allow me to use the `onPrepare` and `onComplete` hook. | ||
If you still want to use the [multiple-cucumber-html-reporter](https://github.com/wswebcreation/multiple-cucumber-html-reporter)-module you can add the following to your config file. | ||
- Install the module with | ||
```bash | ||
npm install multiple-cucumber-html-reporter --save-dev | ||
``` | ||
Maybe even install `fs-extra` to remove the report folder before you start all sessions. | ||
```bash | ||
npm install fs-extra --save-dev | ||
``` | ||
- Add this to your configuration file | ||
```js | ||
// Import the module | ||
const { generate } = require('multiple-cucumber-html-reporter'); | ||
const { removeSync } = require('fs-extra'); | ||
// Example wdio.conf.js | ||
exports.config = { | ||
//.. | ||
// ===== | ||
// Hooks | ||
// ===== | ||
/** | ||
* Gets executed once before all workers get launched. | ||
*/ | ||
onPrepare: () => { | ||
// Remove the `.tmp/` folder that holds the json and report files | ||
removeSync('.tmp/'); | ||
}, | ||
/** | ||
* Gets executed after all workers got shut down and the process is about to exit. | ||
*/ | ||
onComplete: () => { | ||
// Generate the report when it all tests are done | ||
generate({ | ||
// Required | ||
// This part needs to be the same path where you store the JSON files | ||
// default = '.tmp/json/' | ||
jsonDir: '.tmp/json/', | ||
reportPath: '.tmp/report/', | ||
// for more options see https://github.com/wswebcreation/multiple-cucumber-html-reporter#options | ||
}); | ||
} | ||
} | ||
``` |
50121
234