[Pkg-javascript-commits] [node-tap] 80/186: Fix some issues with the Base unit test not hitting 100%
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 1 16:40:46 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-tap.
commit d1f87d7675399db2b2896223039a2c1a324446ae
Author: isaacs <i at izs.me>
Date: Fri Nov 10 12:06:44 2017 -0800
Fix some issues with the Base unit test not hitting 100%
---
lib/base.js | 3 +--
unit/base.js | 21 ++++++++++++++++-----
unit/spawn.js | 3 +++
unit/stdin.js | 3 +++
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/lib/base.js b/lib/base.js
index 580dcbb..93d9511 100644
--- a/lib/base.js
+++ b/lib/base.js
@@ -96,8 +96,7 @@ class Base extends MiniPass {
if (!extra)
extra = extraFromError(er, extra, this.options)
- if (this.results || this.ended) {
- this.results = this.results || {}
+ if (this.results) {
this.results.ok = false
if (this.parent)
this.parent.threw(er, extra, true)
diff --git a/unit/base.js b/unit/base.js
index 78be6c0..f4f3310 100644
--- a/unit/base.js
+++ b/unit/base.js
@@ -70,8 +70,7 @@ t.test('bailout', t => {
t.test('throwing stuff', t => {
const util = require('util')
- const b = new Base({ name: 'ace' })
- const pattern = {
+ const sign = {
name: 'ace',
at: {
line: Number,
@@ -81,9 +80,21 @@ t.test('throwing stuff', t => {
stack: String,
test: 'ace'
}
- const result = b.threw(new Error('this is fine'))
- t.match(result, pattern)
- t.notOk(b.parser.ok)
+
+ t.test('domain error', t => {
+ const b = new Base({ name: 'ace', buffered: true })
+ b.domain.emit('error', new Error('this is fine'))
+ t.notOk(b.parser.ok)
+ t.end()
+ })
+
+ t.test('calling .threw', t => {
+ const b = new Base({ name: 'ace' })
+ const result = b.threw(new Error('this is fine'))
+ t.match(result, sign)
+ t.notOk(b.parser.ok)
+ t.end()
+ })
const c = new Base()
c.parser.end('TAP version 13\nok\n1..1\n')
diff --git a/unit/spawn.js b/unit/spawn.js
index ea77f6d..1f497fc 100644
--- a/unit/spawn.js
+++ b/unit/spawn.js
@@ -5,6 +5,9 @@ const Parser = require('tap-parser')
const node = process.execPath
const file = __filename
+process.env.TAP_BAIL = ''
+process.env.TAP_BUFFER = ''
+
const clean = out => out
.replace(/ # time=[0-9\.]+m?s( \{.*)?\n/g, ' # {time}$1\n')
.replace(/\n(( {2})+)stack: \|-?\n((\1 .*).*\n)+/gm,
diff --git a/unit/stdin.js b/unit/stdin.js
index 6ae9168..c0d3ef7 100644
--- a/unit/stdin.js
+++ b/unit/stdin.js
@@ -2,6 +2,9 @@ const t = require('../')
const Stdin = require('../lib/stdin.js')
const MP = require('minipass')
+process.env.TAP_BAIL = ''
+process.env.TAP_BUFFER = ''
+
t.test('uses stdin if no stream provided', t => {
const s = new Stdin()
t.equal(s.stream, process.stdin)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tap.git
More information about the Pkg-javascript-commits
mailing list