Skip to content

Commit 14cbf2e

Browse files
committed
Don't nextTick root bailout exit
But, still allow 'bailout' event handlers. Do this by overriding the tap.bailout function, rather than by setting an event handler before any user code has a chance to run.
1 parent 632f935 commit 14cbf2e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/root.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ tap._name = 'TAP'
1111

1212
// No sense continuing after bailout!
1313
// allow 1 tick for any other bailout handlers to run first.
14-
tap.on('bailout', function () {
15-
process.nextTick(function () {
16-
process.exit(1)
17-
})
18-
})
14+
tap.bailout = function (reason) {
15+
Test.prototype.bailout.apply(tap, arguments)
16+
process.exit(1)
17+
}
1918

2019
// need to autoend if a teardown is added.
2120
// otherwise we may never see process.on('exit')!

0 commit comments

Comments
 (0)