Skip to content

feat: add ui5 middleware code coverage #70

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export default class extends Generator {
devDependencies: {
shx: "^0.3.4",
"@ui5/cli": "^3",
"@ui5/middleware-code-coverage": "latest",
"ui5-middleware-livereload": "latest",
karma: "^6.4.2",
"karma-chrome-launcher": "^3.2.0",
Expand Down
1 change: 1 addition & 0 deletions generators/app/templates/_.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ deployer/resources/
Makefile*
mta-*
approuter/*/webapp/
tmp/
2 changes: 2 additions & 0 deletions generators/newwebapp/templates/uimodule/ui5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ server:
customMiddleware:
- name: ui5-middleware-livereload
afterMiddleware: compression
- name: "@ui5/middleware-code-coverage"
afterMiddleware: compression
<% if(platform !== 'Static webserver' && platform !== 'SAP NetWeaver'){ -%>
- name: ui5-middleware-cfdestination
afterMiddleware: compression
Expand Down
9 changes: 9 additions & 0 deletions generators/qunit/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Generator from "yeoman-generator";
import semver from "semver";
import jsUtils from "../../helpers/jsutils.js";
import path from "path";
import glob from "glob";
Expand Down Expand Up @@ -152,6 +153,14 @@ export default class extends Generator {
this.config.set("qunittests", tests);
this.options.oneTimeConfig.qunittests = tests;

// set qunit coverage file
if (semver.gte(props.frameworkVersion, "1.113.0")) {
this.config.set("qunitCoverageFile", "qunit-coverage-istanbul.js");
} else {
this.config.set("qunitCoverageFile", "qunit-coverage.js");
}
this.options.oneTimeConfig.qunitCoverageFile = this.config.get("qunitCoverageFile");

const sModule =
(this.options.oneTimeConfig.modulename ? this.options.oneTimeConfig.modulename + "/" : "") + "webapp/";

Expand Down
1 change: 1 addition & 0 deletions generators/qunit/templates/test/unit/unitTests.qunit.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<script src="<%=ui5libsprefix%>resources/sap/ui/thirdparty/qunit-2.js"></script>
<script src="<%=ui5libsprefix%>resources/sap/ui/qunit/qunit-junit.js"></script>
<script src="<%=ui5libsprefix%>resources/sap/ui/qunit/<%=qunitCoverageFile%>"></script>

<script src="unitTests.qunit.js"></script>
</head>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"directory-tree": "^3.0.1",
"glob": "^7.2.0",
"object-assign-deep": "^0.4.0",
"semver": "^7.5.4",
"valid-filename": "^4.0.0",
"yaml": "^2.2.2",
"yeoman-environment": "^3.16.2",
Expand Down