Build toolBuild tooltypeRuns at build time. Nothing of it ships in the deployed application.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →

@ui5/middleware-code-coverage

UI5 CLI server middleware that instruments a project's JavaScript files with Istanbul as the dev server sends them, and generates the coverage report from the records the OpenUI5 QUnit tests send back.

Client-side code coverage needs the source instrumented before the browser runs the tests. This middleware intercepts every .js file before it is sent to the client and instruments it on the fly with Istanbul, creating a source map as it does. A test page swaps the QUnit coverage module qunit-coverage.js for qunit-coverage-istanbul.js, a file of the sap.ui.core library that collects the coverage records while the tests run and sends them to the middleware, which generates the report. Its options set the report type (html by default) and directory (./tmp/coverage-reports), the watermarks thresholds, excludePatterns and the instrumenter's settings. It is entered under server/customMiddleware in ui5.yaml, needs @ui5/cli v3 and is meant for UI5 1.113 and above; @ui5/sample-app lists it as a development dependency.

Facts

Latestv2.0.4ReleasedLast pushLicenceApache-2.0

Where it sits

Lives in
Provides
UI5 testingUI5UI5 testingcapabilityProving a UI still works — unit tests over controllers and formatters, integration tests that drive real controls, and end-to-end runs against a served app.Build and dev-server toolingUI5Build and dev-server toolingcapabilityServing an app locally and building it for deployment — proxying a backend, transpiling, bundling, and shaping the result for whatever will host it.
Requires
@ui5/cli@ui5/cliartifactThe dev server it plugs into as a custom server middleware; the README names UI5 CLI v3 as the minimum.

Who is behind it

UI5UI5OrganisationMaintains this
In the atlas: maintains 8
@UI5
maintainerFrank WeigelPersonContributes to this
In the atlas: contributes to 10
@codeworrior
Yavor IvanovPersonContributes to this
In the atlas: contributes to 17
@d3xter666
Tommy VinhPersonContributes to this
In the atlas: contributes to 4
@devtomtom
Florian VogtPersonContributes to this
In the atlas: contributes to 50, wrote 2
@flovogt
Matthias OßwaldPersonContributes to this
In the atlas: contributes to 29
@matz3
Max ReichmannPersonContributes to this
In the atlas: contributes to 10
@maxreichmann
OpenUI5 BotPersonContributes to this
In the atlas: contributes to 5
@openui5bot
Merlin BeutlbergerPersonContributes to this
In the atlas: contributes to 18, wrote 1
@RandomByte
Gianluca BeilPersonContributes to this
In the atlas: contributes to 6
@werwolf2303
9 contributors

What it declares

Every artifact

Type
Build tool
Origin
By SAP
Runtime
Node.js

As a build tool

Distributed through
npm

Connections3

@ui5/middleware-code-coverage connections@ui5/middleware-code-coveragePROVIDES→ provides2provides stated A custom server middleware for the UI5 CLI's dev server: it adds an HTTP endpoint and instruments every `.js` file on its way to the client. UI5/cli-extensions — middleware-code-coverage README, How It Works: https://github.com/UI5/cli-extensions/tree/main/packages/middleware-code-coverage UI5/cli-extensions — middleware-code-coverage README, How It Works: https://github.com/UI5/cli-extensions/tree/main/packages/middleware-code-coverageBuild and dev-server toolingprovides stated Adds client-side coverage to the QUnit tests of a UI5 project: the middleware instruments the served `.js` files with Istanbul, the test page loads `qunit-coverage-istanbul.js` in place of `qunit-coverage.js`, and the middleware turns the records the tests send into a report. UI5/cli-extensions — middleware-code-coverage README, opening: https://github.com/UI5/cli-extensions/tree/main/packages/middleware-code-coverage UI5/cli-extensions — middleware-code-coverage README, OpenUI5 QUnit Integration: https://github.com/UI5/cli-extensions/tree/main/packages/middleware-code-coverage UI5/cli-extensions — middleware-code-coverage README, How It Works: https://github.com/UI5/cli-extensions/tree/main/packages/middleware-code-coverageUI5 testingNEEDS→ needs1needs stated The dev server it plugs into as a custom server middleware; the README names UI5 CLI v3 as the minimum. UI5/cli-extensions — middleware-code-coverage README, Requirements: https://github.com/UI5/cli-extensions/tree/main/packages/middleware-code-coverage@ui5/cli

Install

npm add @ui5/middleware-code-coverage

Derived from the package name. No recipe recorded; the README has the configuration.

README

quoted from UI5/cli-extensions under Apache-2.0, read
UI5/cli-extensions/packages/middleware-code-coverage/README.mdOn GitHub

UI5 Middleware Code Coverage

This UI5 CLI Server Middleware offers code instrumentation powered by Istanbul. This makes it easy to enable client-side coverage determination.

Coverage Status OpenUI5 Community Slack (#tooling channel) Contributor Covenant REUSE status

Sample

You find this middleware in action in the OpenUI5 Sample App.

Requirements

This middleware requires UI5 CLI v3 and is meant for UI5 1.113 and above.

Limitations

Note that this middleware is currently not compatible with TypeScript based projects, see TypeScript support #189.

Install

npm install @ui5/middleware-code-coverage --save-dev

Usage

  1. Configure it in $yourapp/ui5.yaml:

    The configuration for the custom middleware:

    server:
      customMiddleware:
      - name: "@ui5/middleware-code-coverage"
        afterMiddleware: compression
        configuration:
          report:
            reporter: ["html"]
            "report-dir": "./tmp/coverage-reports"
            watermarks: {
              statements: [50, 80],
              functions: [50, 80],
              branches: [50, 80],
              lines: [50, 80]
            }
          instrument:
            produceSourceMap: true
            coverageGlobalScope: "window.top"
            coverageGlobalScopeFunc: false
          cwd: "./"
          excludePatterns:
          - "lib/"
          - "another/dir/in/webapp"
          - "yet/another/dir"
  2. Change the qunit coverage module qunit-coverage.js to qunit-coverage-istanbul.js in your test html files

    Old:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Unit tests for OpenUI5 App</title>
    
        <script id="sap-ui-bootstrap" src="../../resources/sap-ui-core.js"
          data-sap-ui-theme="sap_horizon"
          data-sap-ui-resourceroots='{
            "ui5.sample": "../../"
          }' data-sap-ui-language="EN" data-sap-ui-async="true">
        </script>
    
        <link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css">
    
        <script src="../../resources/sap/ui/thirdparty/qunit-2.js"></script>
        <script src="../../resources/sap/ui/qunit/qunit-junit.js"></script>
        <script src="../../resources/sap/ui/qunit/qunit-coverage.js"
          data-sap-ui-cover-only="ui5/sample/"
          data-sap-ui-cover-never="ui5/sample/test/"></script>
        <script src="../../resources/sap/ui/thirdparty/sinon.js"></script>
        <script src="../../resources/sap/ui/thirdparty/sinon-qunit.js"></script>
    
        <script src="unitTests.qunit.js"></script>
    </head>
    <body>
        <div id="qunit"></div>
        <div id="qunit-fixture"></div>
    </body>
    </html>

    New:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Unit tests for OpenUI5 App</title>
    
        <script id="sap-ui-bootstrap" src="../../resources/sap-ui-core.js"
          data-sap-ui-theme="sap_horizon"
          data-sap-ui-resourceroots='{
            "ui5.sample": "../../"
          }' data-sap-ui-language="EN" data-sap-ui-async="true">
        </script>
    
        <link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css">
    
        <script src="../../resources/sap/ui/thirdparty/qunit-2.js"></script>
        <script src="../../resources/sap/ui/qunit/qunit-junit.js"></script>
    -   <script src="../../resources/sap/ui/qunit/qunit-coverage.js"
    +   <script src="../../resources/sap/ui/qunit/qunit-coverage-istanbul.js"
          data-sap-ui-cover-only="ui5/sample/"
          data-sap-ui-cover-never="ui5/sample/test/"></script>
        <script src="../../resources/sap/ui/thirdparty/sinon.js"></script>
        <script src="../../resources/sap/ui/thirdparty/sinon-qunit.js"></script>
    
        <script src="unitTests.qunit.js"></script>
    </head>
    <body>
        <div id="qunit"></div>
        <div id="qunit-fixture"></div>
    </body>
    </html>
  3. Execute ui5 serve in the project root folder

  4. Open "http://localhost:8080/test/unit/unitTests.qunit.html?coverage" in a browser of your choice

  5. Check the code coverage Sample for analyzing code coverage

Configuration

cwd [String]: Root folder. Defaults to "./" of the project consuming the middleware.

excludePatterns [Array]: Patterns to exclude from instrumenting. Defaults to [].

report [Object]: Settings for the reporter.

report.reporter [Array]: The report type(s) that would be generated. A list of all the available reports could be found here. Defaults to ["html"].

report["report-dir"] [String]: Where the reports would be generated. Relative to cwd. Defaults to "./tmp/coverage-reports".

report.watermarks [Object]: Coverage thresholds. See High and Low Watermarks for further details.

Defaults to:

{
    statements: [50, 80],
    functions: [50, 80],
    branches: [50, 80],
    lines: [50, 80]
}

instrument [Object]: Settings for the instrumenter. A full set of properties could be seen here.

Defaults to:

{
    produceSourceMap: true,
    coverageGlobalScope: "window.top",
    coverageGlobalScopeFunc: false
}
Front-End Configuration

You can override watermarks (since UI5 1.119.0) via data attributes in the script tag for qunit-coverage-istanbul.js':

...

    <script src="../../resources/sap/ui/qunit/qunit-coverage-istanbul.js"
      data-sap-ui-cover-only="ui5/sample/"
      data-sap-ui-cover-never="ui5/sample/test/"
+     data-sap-ui-cover-watermarks-statements="[90,95]"
+     data-sap-ui-cover-watermarks-functions="[90,95]"
+     data-sap-ui-cover-watermarks-branches="[90,95]"
+     data-sap-ui-cover-watermarks-lines="[90,95]"></script>

...

How It Works

The middleware adds an HTTP endpoint to the development server. For more information about the endpoints, see the API document.

The custom middleware intercepts every .js-file before it is sent to the client. The file is then instrumented on the fly, which includes the dynamic creation of a sourcemap.

The instrumented code and the sourcemap are subsequently delivered to the client instead of the original .js-file.

Integration

The middleware is integrated into OpenUI5 out of the box, but you are not limited by this. With the configuration and the public API, you can set up the middleware to suit your projects' needs.

OpenUI5 QUnit Integration

The qunit-coverage-istanbul.js (part of sap.ui.core library) file requests the instrumented source files by the middleware. While the tests are running, qunit-coverage-istanbul.js takes care of collecting and storing the coverage records into the window.__coverage__ global variable. After the tests are executed, qunit-coverage-istanbul.js sends this data to the middleware, which then generates the code coverage report. Afterwards, the code coverage is displayed on the test page.

Code of Conduct

Please check our Code of Conduct.

Contributing

Please check our Contribution Guidelines.

Support

Please follow our Contribution Guidelines on how to report an issue. Or chat with us in the #tooling channel of the OpenUI5 Community Slack. For public Q&A, use the ui5-cli tag on Stack Overflow.

Licensing

Copyright 2026 SAP SE or an SAP affiliate company and UI5 CLI Extensions contributors. Please see our LICENSE.txt for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.

Apache-2.0, read

History

Latest

v2.0.4

Fixes 1, Dependencies 2

Notes
Bug Fixes
  • middleware-code-coverage: Drop Express coupling (a1ef5af)
Dependencies
  1. v2.0.3

    Fixes 1, Dependencies 2

    Notes
    Bug Fixes
    • middleware-code-coverage: Lazy evaluate exclude patterns (#528) (262f7e7)
    Dependencies
    • Bump body-parser from 1.20.3 to 2.2.2 (606e60e)
    • Bump serve-static from 2.2.0 to 2.2.1 (3906abd)
  2. v2.0.2

    Dependencies 4

    Notes
    Dependencies
    • Bump istanbul-reports from 3.1.7 to 3.2.0 (977244c)
    • Bump router from 2.0.0 to 2.1.0 (0d12240)
    • Bump router from 2.1.0 to 2.2.0 (c4878be)
    • Bump serve-static from 1.16.2 to 2.2.0 (fe86343)
  3. v2.0.1

    Dependencies 3

    Notes
    Dependencies
    • Bump body-parser from 1.20.2 to 1.20.3 (a244517)
    • Bump serve-static from 1.15.0 to 1.16.0 (c2bedbf)
    • Bump sinon from 18.0.1 to 19.0.2 and router from 1.3.8 to 2.0.0 (#303) (1516b38)
  4. v2.0.0

    Breaking 1, Features 1, Dependencies 2

    Notes
    ⚠ BREAKING CHANGES
    • Support for older Node.js has been dropped. Only Node.js 20.11.x and >=22.0.0 as well as npm v8 or higher are supported.
    Features
    Dependencies
    • bump istanbul-lib-instrument from 6.0.1 to 6.0.2 (b7e0c58)
    • bump istanbul-reports from 3.1.6 to 3.1.7 (db471fd)
  5. v1.1.1

    Fixes 1, Dependencies 2

    Notes
    Bug Fixes
    • middleware-code-coverage: fix incomplete string escaping or encoding (#194) (87cabdb)
    Dependencies
    • bump istanbul-lib-coverage from 3.2.0 to 3.2.2 (a60139b)
    • bump istanbul-lib-instrument from 6.0.0 to 6.0.1 (0057e96)
  6. v1.1.0

    Features 1, Dependencies 4

    Notes
    Features
    • middleware-code-coverage: allow coverage watermarks configuration via frontend (#145) (ece9fa6)
    Dependencies
    • bump istanbul-lib-instrument from 5.2.1 to 6.0.0 (fbf8b29)
    • bump istanbul-lib-report from 3.0.0 to 3.0.1 (9bc4b39)
    • bump istanbul-reports from 3.1.5 to 3.1.6 (bd5a78a)
    • bump xml2js from 0.6.0 to 0.6.2 (18904fe)
  7. v1.0.3

    Fixes 1

    Notes
    Bug Fixes
    • middleware-code-coverage: ignore excludes marked as 'external' (#82) (7daeaea)
  8. v1.0.2

    Fixes 1

    Notes
    Bug Fixes
    • deps: bump xml2js from 0.4.23 to 0.5.0 (#77) (300d62e)
  9. v1.0.1

    Fixes 1

    Notes
    Bug Fixes
    • middleware-code-coverage: fix ping endpoint middleware version (e59e921)
  10. v1.0.0

    Features 1

    Notes
    Features
    • middleware-code-coverage: add middleware (e122b92)
9,663downloads per week, npm
Weekly downloads for @ui5/middleware-code-coverage26 complete calendar weeks from 2026-04-20 to 2026-10-18; the latest total is 9663.20 Apr – 26 Apr: 25,77427 Apr – 3 May: 20,4684 May – 10 May: 22,38111 May – 17 May: 23,82818 May – 24 May: 24,27125 May – 31 May: 23,6231 Jun – 7 Jun: 17,1108 Jun – 14 Jun: 26,09615 Jun – 21 Jun: 26,99522 Jun – 28 Jun: 21,59529 Jun – 5 Jul: 20,1006 Jul – 12 Jul: 23,37613 Jul – 19 Jul: 23,62620 Jul – 26 Jul: 25,25227 Jul – 2 Aug: 21,0623 Aug – 9 Aug: 23,12210 Aug – 16 Aug: 16,91017 Aug – 23 Aug: 20,92624 Aug – 30 Aug: 23,61431 Aug – 6 Sept: 18,4857 Sept – 13 Sept: 17,16514 Sept – 20 Sept: 19,60121 Sept – 27 Sept: 20,17728 Sept – 4 Oct: 23,2435 Oct – 11 Oct: 17,23412 Oct – 18 Oct: 9,663

Others providing53

UI5 testing
  1. ui5-test-runnerCommand line running UI5 QUnit and OPA tests in parallelfrom UI5
  2. ui5-middleware-odata-recorderUI5 middleware recording OData traffic as mock server datasetsfrom UI5
  3. jest-environment-ui5Jest environment running UI5 unit tests in Node.jsfrom UI5
  4. openui5-smart-mockserverUI5 MockServer extension generating mock data with Faker.jsfrom UI5
  5. vitest-environment-ui5Vitest environment running UI5 unit tests in Node.jsfrom UI5
  6. wdio-qunit-serviceWebdriverIO service running QUnit test pagesfrom UI5
  7. @openui5/sap.ui.coreFramework core: module loader, MVC runtime, binding, routing, themingfrom UI5
  8. karma-ui5-transpileKarma preprocessor transpiling UI5 sources via ui5-tooling-transpilefrom UI5
  9. ui5-journey-recorderChrome extension generating OPA5 or wdi5 tests from recorded journeysfrom UI5
  10. wdi5-cucumberwdi5 plugin for Cucumber-style BDD tests on Fiori Elements appsfrom UI5
  11. wdi5-fe-selectorswdi5 selectors for locating controls in Fiori Elements appsfrom UI5
  12. wdio-ui5-serviceEnd-to-end testing for UI5 on WebdriverIO with UI5 control selectorsfrom UI5
  13. vscode-ui5-odata-mock-generatorVS Code extension generating OData mock data from service metadatafrom UI5
Build and dev-server tooling
  1. UI5 ToolsVS Code extension to serve, proxy, build and deploy UI5 projectsfrom UI5
  2. ui5-middleware-route-proxyUI5 server middleware proxying route prefixes to a backendfrom UI5
  3. ui5-task-cachebuster-indexingUI5 builder task preparing build output for the cachebusterfrom UI5
  4. ui5-task-transpile-genUI5 builder task transpiling ES6 to ES5 with Babelfrom UI5
  5. ui5-middleware-odata-recorderUI5 middleware recording OData traffic as mock server datasetsfrom UI5
  6. ui5-plugin-loaderUI5 Tooling v4 extension that registers other extensionsfrom UI5
  7. ui5-deployerUI5 Tooling module deploying Fiori/UI5 apps to SAP systemsfrom UI5
  8. ui5-task-dts-generatorUI5 builder task generating d.ts type declarationsfrom UI5
  9. ui5-task-minifierUI5 builder task minifying HTML, CSS and JSON filesfrom UI5
  10. ui5-middleware-oidcUI5 dev server middleware adding an OpenID Connect loginfrom UI5
  11. generator-ui5-library-af-deployYeoman generator for Application Frontend config in UI5 librariesfrom UI5
  12. ui5-middleware-destinationUI5 Tooling middleware proxying destinations and neo-app.json routesfrom UI5
  13. ui5-task-check-eocpUI5 build task warning when the app's UI5 version reaches EOCPfrom UI5
  14. @ui5/cliUI5 Tooling command line for project setup, dev server and buildfrom UI5
  15. ui5-task-btp-manifestUI5 Tooling task writing the service name into the importer manifestfrom UI5
  16. ui5-middleware-approuterUI5 CLI middleware proxying the dev server through @sap/approuterfrom UI5
  17. ui5-middleware-capUI5 CLI middleware running a CDS server inside the UI5 dev serverfrom UI5
  18. ui5-middleware-hmrExperimental UI5 middleware for hot module replacementfrom UI5
  19. ui5-middleware-iasyncUI5 middleware syncing interactions across browsers over websocketfrom UI5
  20. ui5-middleware-indexUI5 middleware serving a chosen welcome page at the root pathfrom UI5
  21. ui5-middleware-livereloadLive reload middleware for the UI5 dev serverfrom UI5
  22. ui5-middleware-oneloginUI5 middleware logging in with Playwright and reusing the sessionfrom UI5
  23. ui5-middleware-serveframeworkUI5 middleware serving a locally built UI5 frameworkfrom UI5
  24. ui5-middleware-servestaticUI5 middleware serving static resources from a path or npm packagefrom UI5
  25. ui5-middleware-simpleproxyDev-server middleware proxying requests to a backend systemfrom UI5
  26. ui5-middleware-ui5UI5 middleware including one UI5 application in anotherfrom UI5
  27. ui5-middleware-webjarsUI5 middleware serving static resources from JAR files (WebJars)from UI5
  28. ui5-middleware-websocketWebSocket support for Express-based dev servers such as UI5'sfrom UI5
  29. ui5-task-cachebusterUI5 builder task cachebusting standalone UI5 applicationsfrom UI5
  30. ui5-task-copyrightUI5 builder task appending copyright headers to source filesfrom UI5
  31. ui5-task-flatten-libraryUI5 builder task flattening library output for SAP NetWeaverfrom UI5
  32. ui5-task-i18ncheckUI5 builder task checking XML views for missing i18n textsfrom UI5
  33. ui5-task-minify-xmlUI5 builder task minifying XML views and fragmentsfrom UI5
  34. ui5-task-pwa-enablerUI5 builder task turning a UI5 app into a progressive web appfrom UI5
  35. ui5-task-zipperBuild task packaging the UI5 build result as a zip archivefrom UI5
  36. ui5-tooling-lessUI5 CLI extension compiling Less files into CSSfrom UI5
  37. ui5-tooling-modulesUI5 tooling extensions loading npm packages as UI5 modulesfrom UI5
  38. ui5-tooling-stringreplaceUI5 CLI extension for string replacement during the buildfrom UI5
  39. ui5-tooling-transpileUI5 CLI extension transpiling code during the UI5 buildfrom UI5
  40. @ui5/loggerInternal logger of the UI5 CLIfrom UI5
  41. @ui5/tooling-webcDeprecated UI5 Tooling extensions for UI5 Web Components wrappersfrom UI5

Details

Sources4
Added by handdiscovered herechecked
npm registry, @ui5/middleware-code-coverageversion, releases, installschecked
github.com/git+ssh://git@github.com/UI5/cli-extensions.gittree, pushes, contributors, CIchecked
packages/middleware-code-coverage/README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
runtimesnode
latestv2.0.4
first release
releases and cadence11, ~90d median
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainui5, developer-experience
Contributors9
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:ui5-middleware-code-coverage
JSON
/artifacts/ui5-middleware-code-coverage.json
MCP
Connecting an agent