Skip to content

Commit 25047a4

Browse files
committed
[FEATURE] Add "test" command
Just some very basic PoC. Only works with the openui5-sample-app: https://github.com/SAP/openui5-sample-app
1 parent dcd1d63 commit 25047a4

File tree

3 files changed

+1030
-134
lines changed

3 files changed

+1030
-134
lines changed

lib/cli/commands/test.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Test
2+
3+
let test = {
4+
command: "test",
5+
describe: "TBD"
6+
};
7+
8+
test.handler = async function(argv) {
9+
const karma = require("karma");
10+
const normalizer = require("@ui5/project").normalizer;
11+
const server = require("@ui5/server").server;
12+
13+
const tree = await normalizer.generateProjectTree({
14+
translator: argv.translator,
15+
configPath: argv.config
16+
});
17+
18+
await server.serve(tree, {
19+
port: 8080
20+
});
21+
22+
const karmaServer = new karma.Server({
23+
basePath: "webapp",
24+
frameworks: ["qunit", "openui5"],
25+
openui5: {
26+
path: "http://localhost:8080/resources/sap-ui-core.js"
27+
},
28+
client: {
29+
openui5: {
30+
config: {
31+
theme: "sap_belize",
32+
language: "EN",
33+
bindingSyntax: "complex",
34+
compatVersion: "edge",
35+
preload: "async",
36+
resourceroots: {"sap.ui.demo.todo": "./base"}
37+
},
38+
tests: [
39+
"sap/ui/demo/todo/test/unit/allTests",
40+
"sap/ui/demo/todo/test/integration/AllJourneys"
41+
]
42+
}
43+
},
44+
files: [
45+
{pattern: "**", included: false, served: true, watched: true}
46+
],
47+
reporters: ["progress"],
48+
port: 9876,
49+
logLevel: "INFO",
50+
browserConsoleLogOptions: {
51+
level: "warn"
52+
},
53+
browsers: ["Chrome"]
54+
}, function(exitCode) {
55+
console.log("Karma has exited with " + exitCode);
56+
process.exit(exitCode);
57+
});
58+
karmaServer.start();
59+
};
60+
61+
module.exports = test;

0 commit comments

Comments
 (0)