wdio-coverage-service
v1.0.2
Published
A WebdriverIO plugin for Istanbul-Coverage results via nyc
Downloads
367
Maintainers
Readme
WDIO COVERAGE Service
A WebdriverIO plugin. Extracts coverage information.
FAQ
Limitations:
- currently coverage results aren't separated e.g. running chrome, firefox in parallel would result in a merged coverage result out of both runs
Why are't you using devtools-service:
- If you are using a web-framework made of large files, you can't exclude them. Which makes the test very slow
- Works only in chrome
- Wasn't available when this plugin was written
Why is this not on Github
Github actions have not been a available.
WDIO Version Compatibility
The chart below shows the versions of this Service and their WDIO compatibility version.
| WDIO Coverage Service | WDIO | | ------------------ | ---- | | ^0.0.1 | v6 (sync-mode) | | ^1.0.x | v7 (async) |
WDIO v6 Compatibility
Installation
- NPM
npm install wdio-coverage-service --save-dev
Services: [
'dot',
'coverage'
],
Configuration
This plugin is fetching the test coverage information after each suit/scenario into .nyc_output
.
- The page under test must be instrumented. Check NYC.
- The report must be generated with NYC, after the WDIO run.
An example with instrumented code and static server can be found in test/integration
.
Usually, the framework of your choice has already middleware for serving and instrumenting on the fly.
Example(please add more with PR):
- https://github.com/istanbuljs/babel-plugin-istanbul
Example:
{
"scripts": {
"test": "npm run-script instrument && npm run-script wdio && nyc report",
"instrument": "nyc instrument ./webapp ./dist --complete-copy --delete",
"wdio": "npx wdio wdio.conf.js",
"cover-report": "nyc report"
},
"nyc": {
"all": true,
"check-coverage": false,
"exclude": [],
"extension": [
"*.js"
],
"reporter": [
"json",
"text",
"lcov"
]
}
}
For more information on WebdriverIO see the homepage.