Permalink
Browse files

wip savepoint

  • Loading branch information...
1 parent b58eb2c commit bc58e6a448bc16f50264fd88072bcfa003d39b15 @isaacs isaacs committed Feb 21, 2012
Showing with 13 additions and 18 deletions.
  1. +1 −1 lib/tap-global-harness.js
  2. +12 −17 lib/tap-harness.js
@@ -49,7 +49,7 @@ function GlobalHarness () {
var streamEnded = false
this.on("end", function () {
- //console.error("global ending the stream")
+ // console.error("global ending the stream")
if (!streamEnded) {
this.results.list.forEach(function (res) {
output.write(res)
View
@@ -5,7 +5,8 @@
// TODO:
-// - Bailout should stop running any tests.
+// - Bailout should stop running any tests, without losing results so far.
+// - "skip" in the test config obj should skip it.
module.exports = Harness
require("inherits")(Harness, require("events").EventEmitter)
@@ -17,8 +18,6 @@ var Results = require("./tap-results")
function Harness (Test) {
if (!(this instanceof Harness)) return new Harness(Test)
- //console.error("Test in "+this.constructor.name, Test)
-
this._Test = Test
this._plan = null
this._children = []
@@ -28,11 +27,6 @@ function Harness (Test) {
this._planSum = 0
this.results = new Results()
- // emit result events on the harness.
- //this.results.on("result", function (res) {
- // console.error("proxying result ev from res to harness")
- // this.emit("result", res)
- //}.bind(this))
var me = this
this.results.on("result", this.emit.bind(this, "result"))
@@ -46,6 +40,7 @@ function Harness (Test) {
Harness.super.call(this)
}
+
// this function actually only gets called bound to
// the Harness object, and on process.nextTick. Even if
// passed as an event handler, everything *else* will
@@ -60,25 +55,25 @@ Harness.prototype.process = function () {
// handle the current one before moving onto the next.
this.childEnd(this._current)
}
+
+ // at this point, this._children[0] should be the next one
+ // if we've bailed out, then just drop the rest.
+
var skip = true
- if (!this._bailedOut) while (skip) {
+ while (skip) {
//console.error("checking for skips")
var current = this._current = this._children.shift()
if (current) {
- skip = current.conf.skip
+ skip = this._bailedOut || current.conf.skip
if (skip) {
//console.error("add a failure for the skipping")
this.results.add(assert.fail(current.conf.name
,{skip:true, diag:false}))
+ current = null
}
} else skip = false
}
- // keep processing through skipped tests, instead of running them.
- if (current && this._bailedOut) {
- return this.process()
- }
-
//console.error("got current?", !!current)
if (current) {
current.on("end", this.process)
@@ -180,7 +175,7 @@ Harness.prototype.test = function test (name, conf, cb) {
// will prevent it from bubbling.
var clear = clearTimeout.bind(null, timer)
t.on("end", clear)
- // t.on("afterbailout", clear)
+ t.on("afterbailout", clear)
}
})
t.on("ready", cb.bind(t, t))
@@ -204,7 +199,7 @@ Harness.prototype.bailout = function (message) {
this._bailedOut = true
this.emit("bailout", message)
this.emit("afterbailout", message)
- this.end()
+ // this.end()
}
Harness.prototype.add = function (child) {

0 comments on commit bc58e6a

Please sign in to comment.