[Pkg-javascript-commits] [node-tap] 71/186: code cleanup and a helpful comment
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 1 16:40:45 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 fb40721f18c70ee5e99e2a96590a6899827189a0
Author: isaacs <i at izs.me>
Date: Thu Nov 9 13:55:49 2017 +0000
code cleanup and a helpful comment
---
lib/base.js | 11 ++++++-----
lib/test.js | 5 ++++-
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/lib/base.js b/lib/base.js
index 184eff2..580dcbb 100644
--- a/lib/base.js
+++ b/lib/base.js
@@ -53,7 +53,7 @@ class Base extends MiniPass {
this.main = Base.prototype.main
domain.create().add(this)
- this.domain.on('error', this.threw.bind(this))
+ this.domain.on('error', er => this.threw(er))
const doDebug = typeof options.debug === 'boolean' ? options.debug
: /\btap\b/i.test(process.env.NODE_DEBUG || '')
@@ -80,7 +80,7 @@ class Base extends MiniPass {
if (this.timer)
clearTimeout(this.timer)
- this.timer = setTimeout(this.timeout.bind(this), n)
+ this.timer = setTimeout(() => this.timeout(), n)
/* istanbul ignore else */
if (this.timer.unref)
this.timer.unref()
@@ -97,6 +97,7 @@ class Base extends MiniPass {
extra = extraFromError(er, extra, this.options)
if (this.results || this.ended) {
+ this.results = this.results || {}
this.results.ok = false
if (this.parent)
this.parent.threw(er, extra, true)
@@ -191,9 +192,9 @@ class Base extends MiniPass {
omitVersion: this.omitVersion,
preserveWhitespace: this.preserveWhitespace
})
- this.parser.on('line', this.online.bind(this))
- this.parser.once('bailout', this.onbail.bind(this))
- this.parser.on('complete', this.oncomplete.bind(this))
+ this.parser.on('line', l => this.online(l))
+ this.parser.once('bailout', reason => this.onbail(reason))
+ this.parser.on('complete', result => this.oncomplete(result))
}
inspect () {
diff --git a/lib/test.js b/lib/test.js
index 758d3e5..e22bf22 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -267,7 +267,6 @@ class Test extends Base {
} else
done()
-
this.debug('MAIN post', this)
}
@@ -720,6 +719,10 @@ class Test extends Base {
}
endAll (sub) {
+ // in the case of the root TAP test object, we might sometimes
+ // call endAll on a bailing-out test, as the process is ending
+ // In that case, we WILL have a this.occupied and a full queue
+ // These cases are very rare to encounter in other Test objs tho
this.processing = true
if (this.occupied) {
const p = this.occupied
--
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