Skip to content

Commit 6d3f8f9

Browse files
committed
tmp: no buffer
1 parent e4069e1 commit 6d3f8f9

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

scripts/ciTest.js

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,31 @@ function runTests() {
6565
console.warn(`input.js does not exist in ${testDir}`);
6666
} else {
6767
console.log(`testing ${file}`);
68+
6869
// note existsSync test already ensure that it is a directory
69-
cp.exec(
70-
`node input.js`,
71-
{ cwd: testDir, encoding: "utf8" },
72-
function (error, stdout, stderr) {
73-
console.log(stdout);
74-
75-
if (error !== null) {
76-
console.log(`❌ error in ${file} with stderr:\n`, stderr);
77-
throw error;
78-
} else {
79-
console.log("✅ success in", file);
80-
}
70+
let p = cp.spawn(`node`, ["input.js"], { cwd: testDir });
71+
72+
p.stdout
73+
.setEncoding("utf8")
74+
.on("data", line => {
75+
console.log(line);
76+
});
77+
78+
let error = '';
79+
p.stderr
80+
.setEncoding("utf8")
81+
.on("data", line => {
82+
error += line + "\n";
83+
});
84+
85+
p.on("close", () => {
86+
if (error) {
87+
console.log(`❌ error in ${file} with stderr:\n`, error);
88+
throw new Error(error);
89+
} else {
90+
console.log("✅ success in", file);
8191
}
82-
);
92+
});
8393
}
8494
});
8595
}

0 commit comments

Comments
 (0)