This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathcompile.js
56 lines (52 loc) · 1.51 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
45
46
47
48
49
50
51
52
53
54
55
56
const fs = require("fs");
const path = require("upath");
const process = require("process");
qx.Class.define("qx.compiler.CompilerApi", {
extend: qx.tool.cli.api.CompilerApi,
members: {
/**
* Register compiler tests
* @param {qx.tool.cli.commands.Command} command
* @return {Promise<void>}
*/
async beforeTests(command) {
const COMPILER_TEST_PATH = path.join("test", "compiler");
function addTest(test) {
command.addTest(new qx.tool.cli.api.Test(test, async function() {
console.log("****");
console.log("**** Running " + test);
console.log("****");
result = await qx.tool.utils.Utils.runCommand({
cwd: COMPILER_TEST_PATH,
cmd: "node",
args: [ test + ".js" ],
shell: false,
env: {
QX_JS: require.main.filename
}
});
this.setExitCode(result.exitCode);
})).setNeedsServer(false);
}
try {
try {
fs.unlinkSync("test/qx");
}catch(ex) {
// Nothing
}
let files = fs.readdirSync(COMPILER_TEST_PATH);
files.forEach(file => {
if (fs.statSync(path.join(COMPILER_TEST_PATH, file)).isFile() && file.endsWith(".js")) {
addTest(path.changeExt(path.basename(file), ""));
}
});
} catch (e) {
console.error(e);
process.exit(1);
}
}
}
});
module.exports = {
CompilerApi: qx.compiler.CompilerApi
};