Skip to content

feat(middleware-code-coverage)!: Support UI5 CLI v5, Input Source Maps and TypeScript - #619

Merged
devtomtom merged 1 commit into
mainfrom
poc-rework-middleware-code-coverage
Oct 27, 2026
Merged

devtomtom merged 1 commit into
mainfrom
poc-rework-middleware-code-coverage

Conversation

@devtomtom

@devtomtom devtomtom commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Overview

Reworks @ui5/middleware-code-coverage to support UI5 CLI v5. The middleware now instruments the build output exposed through the new builtResources reader (Specification Version 5.0+), handles preload bundles and source maps.

⚠️ BREAKING CHANGE: The middleware uses specVersion 5.0 and requires UI5 CLI v5 or higher.

What changed

Coverage against the build output. Instead of instrumenting source resources, the middleware reads from builtResources (root project + dependencies). The UI5 runtime loads each covered module individually as its unminified -dbg variant; the middleware instruments that -dbg source for faithful per-line coverage, falling back to the runtime file when no -dbg exists (minify disabled, or -dbg requested directly), and reports everything under the runtime path so coverage keys line up with what the client selects.

Bundle handling. Preload bundles (*-preload.js, etc.) are never instrumented — a concatenated bundle corrupts coverage and its indexed source map crashes istanbul. They are served verbatim by the middleware.

Source maps / TypeScript. When a module carries a sourceMappingURL (inline data-URI or a sibling .map), the middleware feeds istanbul the input source map so coverage is attributed to the original source — e.g. a TypeScript project's -dbg output maps back to the .ts.
Fixes: #189

Related UI5 runtime change:
UI5/openui5@8baf315

JIRA: CPOUI5FOUNDATION-1350
JIRA: CPOUI5FOUNDATION-1203

@devtomtom
devtomtom force-pushed the poc-rework-middleware-code-coverage branch 2 times, most recently from 31b4e2f to 596ac88 Compare October 19, 2026 09:46
@devtomtom devtomtom changed the title feat!: UI5 Middleware Code Coverage v3 feat(middleware-code-coverage)!: Support UI5 CLI v5 with bundle handling and source maps Oct 19, 2026
@devtomtom
devtomtom force-pushed the poc-rework-middleware-code-coverage branch from bd97294 to aff646c Compare October 19, 2026 11:20
@devtomtom
devtomtom requested review from flovogt and matz3 October 19, 2026 12:42

@d3xter666 d3xter666 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution works as expected and I have tested the scenarios in the fixtures and whether they provide coverage and correct paths to the files.

As this is a breaking change it's worth mentioning why is it breaking.
For exmaple: specVersion 5 is not available in @ui5/cli version 4 as well as builtResources

@matz3 matz3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a first review, but looks very good so far 👍🏻
I have tested it locally on macOS and want to test on Windows.

@devtomtom
devtomtom force-pushed the poc-rework-middleware-code-coverage branch from f1943e6 to c2fc717 Compare October 23, 2026 13:50
@matz3

matz3 commented Oct 23, 2026

Copy link
Copy Markdown
Member

I have tested it locally on macOS and want to test on Windows.

I also tested on Windows, incl. TypeScript and it works as expected. Rewriting the paths to strip the drive (e.g. c:\\) is needed and works as expected.

@devtomtom
devtomtom force-pushed the poc-rework-middleware-code-coverage branch 3 times, most recently from ff08257 to 97a718e Compare October 27, 2026 07:58
@devtomtom
devtomtom requested a review from matz3 October 27, 2026 09:38
@devtomtom
devtomtom force-pushed the poc-rework-middleware-code-coverage branch from 890745c to ec6cc28 Compare October 27, 2026 15:31
…dle handling and source maps

BREAKING CHANGE: The middleware uses specVersion 5.0 which requires UI5 CLI v5 or higher.

- Coverage against the build output. Instead of instrumenting source resources,
the middleware reads from builtResources (root project + dependencies). The UI5
runtime loads each covered module individually as its unminified -dbg variant;
the middleware instruments that -dbg source for faithful per-line coverage,
falling back to the runtime file when no -dbg exists (minify disabled, or -dbg
requested directly), and reports everything under the runtime path so coverage
keys line up with what the client selects.

- Bundle handling. Preload bundles (*-preload.js, etc.) are never instrumented — a
concatenated bundle corrupts coverage and its indexed source map crashes
istanbul. They are served verbatim by the middleware.

- Source maps / TypeScript. When a module carries a sourceMappingURL (inline data-
URI or a sibling .map), the middleware feeds istanbul the input source map so
coverage is attributed to the original source — e.g. a TypeScript project's -dbg
output maps back to the .ts.

Related UI5 runtime change:
UI5/openui5@8baf315.

JIRA: CPOUI5FOUNDATION-1350
JIRA: CPOUI5FOUNDATION-1203
@devtomtom
devtomtom force-pushed the poc-rework-middleware-code-coverage branch from ec6cc28 to 22be0d5 Compare October 27, 2026 15:40
@devtomtom devtomtom changed the title feat(middleware-code-coverage)!: Support UI5 CLI v5 with bundle handling and source maps feat(middleware-code-coverage)!: Support UI5 CLI v5, Input Source Maps and TypeScript Oct 27, 2026
@devtomtom
devtomtom merged commit 5cf6dfe into main Oct 27, 2026
18 checks passed
@devtomtom
devtomtom deleted the poc-rework-middleware-code-coverage branch October 27, 2026 15:49
devtomtom pushed a commit that referenced this pull request Oct 29, 2026
🚜 New release prepared
---


##
[3.0.0-alpha.1](middleware-code-coverage-v3.0.0-alpha.0...middleware-code-coverage-v3.0.0-alpha.1)
(2026-10-29)


### ⚠ BREAKING CHANGES

* **middleware-code-coverage:** The middleware uses specVersion 5.0 and
requires UI5 CLI v5 or higher.
* **middleware-code-coverage:** UI5 Middleware Code Coverage supports
now "^22.22.3 || ^24.15.0 || >=26.0.0".
    - ci: Align workflow test node version
- ci: Use Node 22.22.3 to avoid registerHooks load-hook bug, fixed in
22.22.3
* 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

* **middleware-code-coverage:** Set minimal required Node version
"22.22.3"
([292fc66](292fc66))
* **middleware-code-coverage:** Support UI5 CLI v5, Input Source Maps
and TypeScript
([#619](#619))
([5cf6dfe](5cf6dfe))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@ui5/middleware-code-coverage - TypeScript support

3 participants