Skip to content

Commit 72e34ad

Browse files
author
James Halliday
committed
fixed the many test, broke the exit test
1 parent fa706ae commit 72e34ad

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

index.js

+5-12
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,16 @@ function createExitHarness (conf) {
3232
stream.on('end', function () { ended = true });
3333

3434
if (conf.exit === false) return harness;
35-
if (!process.exit || !process._getActiveHandles) return harness;
35+
if (!canEmitExit || !canExit) return harness;
3636

37-
var iv = setInterval(function () {
38-
if (process._getActiveHandles().length > 1) return;
39-
40-
clearInterval(iv);
41-
setTimeout(function () {
42-
if (ended) return;
37+
process.on('exit', function (code) {
38+
if (!ended) {
4339
for (var i = 0; i < harness._tests.length; i++) {
4440
var t = harness._tests[i];
4541
t._exit();
4642
}
47-
}, 100);
48-
49-
setTimeout(function () {
50-
process.exit(harness._exitCode);
51-
}, 105);
43+
}
44+
process.exit(code || harness._exitCode);
5245
});
5346
return harness;
5447
}

0 commit comments

Comments
 (0)