ui5-middleware-code-coverage-advanced
v0.0.3
Published
Code Coverage middleware for UI5-tooling
Downloads
1,541
Maintainers
Readme
ui5-middleware-code-coverage-advanced
A code instrumenter middleware for ui5-server, enabling code coverage on the fly.
- support inline source maps
- you can debug the instrumented code
- support clean
- clears
.nyc_output
on startup
- clears
- support baseline
- creates file in
.nyc_output/baseline.json
- your coverage report contains all js files, not just the one loaded during test
- creates file in
Inspired by ui5-middleware-code-coverage.
Component-preload.js
Component-preload has up to today no source maps. Therefore this plugin supports currently only apps server from the standard folder webapp
.
There is no way to map the coverage back the the original source.
Install
npm install ui5-middleware-code-coverage-advanced --save-dev
Usage - UI5-Tooling
Define the dependency in
$yourApp/package.json
:"devDependencies": { "ui5-middleware-code-coverage-advanced": "*" }, "ui5": { "dependencies": [ "ui5-middleware-code-coverage-advanced" ] }
configure it in
$yourApp/ui5.yaml
:server: customMiddleware: - name: ui5-middleware-code-coverage-advanced afterMiddleware: compression mountPath: / configuration: enabled: true
Usage - Test-Runner
Extract the window.__coverage__
during test run with your test-runner.
| Test-Rummer | Plugin | Description | Deprecated | | --- | --- | --- | --- | | WDIO | wdio-coverage-service | not needed if you don't care about baseline | | | Uiveri5 | | TO MY KNOWLEDGE NOT EXISTING | :warning: | | Karma | karma-coverage |Test runner used by OPA | :warning: |
WDIO
This works now native, no need for any middleware or plugins(but no baseline support), simply do:
services: [
["devtools", {
coverageReporter: {
enable: true,
type: "lcov",
logDir: __dirname + "/coverage",
exclude: [/resources/]
}
}]
],