openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

Qunit Coverage not working with ES6+ syntax

Open desaisamay opened this issue 3 years ago • 3 comments

Hello Team,

We have been using Qunits for testing our controller code on our fiori applications and we have been using ES6+ syntax. The unit tests do work fine and give you the results however when I enable the coverage using the on the qunit runner html page then it errors out at specifc points where a ES6+ syntax had been used.

It seems to be like the library sap.ui.qunit.qunit-coverage doesnt likes the es6+ syntax. Anyone else facing similar issue and have found a solutiuon around? the alternative we have been doing till now is to convert the code below es6 because we tested it and it works but would like to avoid doing that for obvious reasons.

Kindly fix this as soon as possible.

Regards, Samay Desai

desaisamay avatar Jun 20 '22 07:06 desaisamay

Got the same issue today : blanket.js is quite old and it does not support recent syntax. Furthermore, when using async loading of modules, it does not even try to apply blanket.

ArnaudBuchholz avatar Jun 22 '22 13:06 ArnaudBuchholz

Correct. And I have more bad news: there are no plans to enhance client-side code-coverage.

We plan to fade out the client-side instrumentation as it conflicts with CSP support anyhow. We rather imagine server side or build time instrumentation. There's no ui5-tooling support for this (yet?). Maybe someone from the community can come up with a solution.

@petermuessig anything to add?

codeworrior avatar Jun 22 '22 14:06 codeworrior

We're currently working on this. We'll keep you up to date. Backlog item is CPOUI5FOUNDATION-531.

flovogt avatar Sep 06 '22 06:09 flovogt

We have published a new package @ui5/middleware-code-coverage offering code instrumentation for ES6+ code. This new middleware requires UI5 version 1.113.0 and above.

For further information, see https://github.com/SAP/ui5-tooling-extensions/tree/main/packages/middleware-code-coverage#readme.

The team is looking forward to feedback. Thanks for opening this issue here.

flovogt avatar Apr 20 '23 10:04 flovogt