diff --git a/lib/spawn.js b/lib/spawn.js index f9598799d..228499488 100644 --- a/lib/spawn.js +++ b/lib/spawn.js @@ -109,7 +109,7 @@ class Spawn extends Base { this.options.signal = signal // spawn closing with no tests is treated as a skip. - if (this.results.plan && this.results.plan.skipAll && !code && !signal) + if (this.results && this.results.plan && this.results.plan.skipAll && !code && !signal) this.options.skip = this.results.plan.skipReason || true if (code || signal) { diff --git a/lib/tap.js b/lib/tap.js index 1d9a042e4..d5b3cf787 100644 --- a/lib/tap.js +++ b/lib/tap.js @@ -9,9 +9,9 @@ const _didPipe = Symbol('_didPipe') const monkeypatchEpipe = () => { const emit = process.stdout.emit - process.stdout.emit = (ev, er) => { + process.stdout.emit = function (ev, er) { if (ev !== 'error' || er.code !== 'EPIPE') - return emit.apply(process, arguments) + return emit.apply(process.stdout, arguments) } } diff --git a/package-lock.json b/package-lock.json index 760e9e17c..b75716f94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "tap", - "version": "11.1.0", + "version": "11.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 04516a1f3..2ad646a34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tap", - "version": "11.1.0", + "version": "11.1.1", "author": "Isaac Z. Schlueter (http://blog.izs.me)", "description": "A Test-Anything-Protocol library", "homepage": "http://node-tap.org/", diff --git a/test/regression-many-asserts-epipe.js b/test/regression-many-asserts-epipe.js new file mode 100644 index 000000000..2d4290cf2 --- /dev/null +++ b/test/regression-many-asserts-epipe.js @@ -0,0 +1,9 @@ +'use strict' +// See https://github.com/tapjs/node-tap/issues/422 +const t = require('../') +t.test('just a lot of asserts in rapid succession', t => { + for (let i = 0; i < 5000; i++) { + t.pass('a number is ' + i) + } + t.end() +})