-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverage Reporting from OPA5#iStartMyAppInAFrame() #138
Comments
This is a known gap, which is also mentioned in the UI5 Dev Guide (https://ui5.sap.com/#/topic/ae448243822448d8ba04b4784f4b09a0.html). While the solution from the blog post might work, it is not recommended from our side and might break in future. A better solution would be to either have an additional preprocessor or to extend the coverage preprocessor to add some more code that passes the coverage object from the parent to the frame. This is planned to be addressed (no concrete timeline). (Internal reference CPOUI5FOUNDATION-44) |
Hi @matz3, thanks for sharing the information! I didn't know there was information about this in the UI5 SDK, sorry for having missed that. Thank you very much for your work! |
@matz3 Is code coverage now supported? anyupdates? |
As discussed with @shahzeb79 there are no updates as of today. We are planning to work on this soon(™️). Possibly @ecker can provide a more precise timeline. |
Hi @matz3, I just came around trying this out in our project. As we have karma integrated with grunt, the configuration feels a bit clunky: const karmaConfig = grunt.config.get("karma.options");
require("karma-ui5/helper").configureIframeCoverage(karmaConfig);
grunt.config.set("karma.options", karmaConfig); I don't know it you want to consider simplifying this a bit, or at least add it to the documentation, because this is non-obvious and I'm not sure I've covered all necessary cases. |
As the execution order of plugins is not defined/guaranteed, we can't do the coverage configuration enhancement within our plugin. That's why we needed to introduce a separate helper module. But we haven't looked into how this would be done with grunt or other task runners. Feel free to create a PR to add documentation to the README and/or to enhance the |
Hi experts,
in my karma config, I added the basic options to get coverage reporting to work:
My tests are currently mostly OPA5, and as i need to run everything inside an flpSandbox, I start my app in an IFrame using OPA5#iStartMyAppInAFrame(). However, it seems like the coverage now is not reported correctly, as everything that happens within the IFrame is not covered.
I only found this official (?) blogpost regarding the topic. However, it seems to use deprecated features of UI5 (
jQuery.sap.require()
), uses features I have never before used (sap.ui.qunit.qunit-coverage
), and it features a workaround for reporting out of the IFrame involving manually monkey-patchingwindow.eval
.Are there better ways to get this to work? Am I missing some option in
karma-ui5
? Or is this something I'd better address towards UI5 directly?I'm testing a UI5 application in script mode.
Thank you very much for your help!
Kind regards
Lukas
The text was updated successfully, but these errors were encountered: