-
Notifications
You must be signed in to change notification settings - Fork 4
/
compile.js
44 lines (41 loc) · 1.24 KB
/
compile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
qx.Class.define("qxl.apiviewer.compile.CompilerApi", {
extend: qx.tool.cli.api.CompilerApi,
members: {
async load() {
this.addListener(
"changeCommand",
function () {
let command = this.getCommand();
if (command instanceof qx.tool.cli.commands.Test) {
command.addListener("runTests", this.__appTesting, this);
if (command.setNeedsServer) {
command.setNeedsServer(true);
}
}
},
this
);
return this.base(arguments);
},
// Test application in headless Chrome and Firefox
async __appTesting(data) {
let result = data.getData ? data.getData() : {};
const createTestCafe = this.require("testcafe");
const testcafe = await createTestCafe("localhost");
try {
const runner = testcafe.createRunner();
const failedCount = await runner
.src(["tests/testcafe.js"])
.browsers(["chrome:headless", "firefox:headless"])
.run();
console.log("Tests failed: " + failedCount);
result.setExitCode(failedCount);
} finally {
await testcafe.close();
}
},
},
});
module.exports = {
CompilerApi: qxl.apiviewer.compile.CompilerApi,
};