Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ui5-middleware-code-coverage-advanced

bkrrrr524MIT0.0.3

Code Coverage middleware for UI5-tooling

UI5-tooling, code-coverage, sapui5, openui5, UI5, NYC

readme

CI

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
  • support baseline
    • creates file in .nyc_output/baseline.json
    • your coverage report contains all js files, not just the one loaded during test

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

  1. Define the dependency in $yourApp/package.json:

     "devDependencies": {
         "ui5-middleware-code-coverage-advanced": "*"
     },
     "ui5": {
       "dependencies": [
         "ui5-middleware-code-coverage-advanced"
       ]
     }
  2. 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/]
            }
        }]
    ],