File index.js changed (mode: 100755) (index 8bb6b10..6a092d4) |
... |
... |
const fs = require("fs"), |
9 |
9 |
argv = require("minimist")(process.argv.slice(2)), |
argv = require("minimist")(process.argv.slice(2)), |
10 |
10 |
defPath = argv.p ? argv.p : argv.project; |
defPath = argv.p ? argv.p : argv.project; |
11 |
11 |
|
|
|
12 |
|
let assertionsPassed = 0; |
|
13 |
|
|
12 |
14 |
if (argv.test || argv.t) { |
if (argv.test || argv.t) { |
13 |
15 |
const tag = "duration"; |
const tag = "duration"; |
14 |
16 |
console.time(tag); |
console.time(tag); |
15 |
17 |
process.on("exit", () => { |
process.on("exit", () => { |
16 |
18 |
cursor.green(); |
cursor.green(); |
|
19 |
|
console.log(`assertions passed: ${assertionsPassed}`); |
17 |
20 |
console.timeEnd(tag); |
console.timeEnd(tag); |
18 |
21 |
cursor.reset(); |
cursor.reset(); |
19 |
22 |
}); |
}); |
|
... |
... |
if (argv.test || argv.t) { |
22 |
25 |
processDef(defPath); |
processDef(defPath); |
23 |
26 |
|
|
24 |
27 |
function processDef(defPath) { |
function processDef(defPath) { |
25 |
|
console.log("processing ", defPath); |
|
26 |
28 |
readDef(defPath).then((obj) => { |
readDef(defPath).then((obj) => { |
27 |
29 |
let result = obj; |
let result = obj; |
28 |
30 |
if (argv.common || argv.c) { |
if (argv.common || argv.c) { |
|
... |
... |
function processDef(defPath) { |
42 |
44 |
tmp.dir((err, tmpDir) => { |
tmp.dir((err, tmpDir) => { |
43 |
45 |
if (err) throw err; |
if (err) throw err; |
44 |
46 |
const execFile = path.join(tmpDir, "test"); |
const execFile = path.join(tmpDir, "test"); |
45 |
|
console.log("test directory:", tmpDir); |
|
46 |
47 |
result = `${compiler} ${result} -o ${execFile}`; |
result = `${compiler} ${result} -o ${execFile}`; |
47 |
48 |
if (argv.verbose || argv.v) { |
if (argv.verbose || argv.v) { |
48 |
49 |
console.log(result); |
console.log(result); |
49 |
50 |
} |
} |
50 |
|
let build = shell.exec(result); |
|
|
51 |
|
const silent = !(argv.verbose || argv.v); |
|
52 |
|
let build = shell.exec(result, {silent}); |
51 |
53 |
if (build.code == 0) { |
if (build.code == 0) { |
52 |
|
let assertionsPassed = 0; |
|
53 |
|
process.on("exit", () => { |
|
54 |
|
cursor.green(); |
|
55 |
|
console.log(`assertions passed: ${assertionsPassed}`); |
|
56 |
|
cursor.reset(); |
|
57 |
|
}); |
|
58 |
|
|
|
59 |
|
shell.exec("./test", { cwd: tmpDir }); |
|
|
54 |
|
shell.exec("./test", { cwd: tmpDir, silent }); |
60 |
55 |
fs.readFile( |
fs.readFile( |
61 |
56 |
path.join(tmpDir, "result.json"), |
path.join(tmpDir, "result.json"), |
62 |
57 |
"utf8", |
"utf8", |