Comparing version 0.6.0 to 0.6.1
@@ -60,3 +60,3 @@ // | ||
var batch = vow.batch, | ||
event = vow.binding.context.event || 'success' | ||
event = vow.binding.context.event || 'success', | ||
self = this; | ||
@@ -63,0 +63,0 @@ |
@@ -12,6 +12,23 @@ var options = { tail: '\n', raw: true }; | ||
}; | ||
function removeCircularSuite(obj, suite) { | ||
var result = {}; | ||
if (typeof obj !== 'object' || obj === null) return obj; | ||
Object.keys(obj).forEach(function(key) { | ||
if (obj[key] === suite) { | ||
result[key] = {}; | ||
} else { | ||
result[key] = removeCircularSuite(obj[key], suite || obj.suite); | ||
} | ||
}); | ||
return result; | ||
}; | ||
this.report = function (obj) { | ||
puts(JSON.stringify(obj)); | ||
puts(JSON.stringify(removeCircularSuite(obj))); | ||
}; | ||
this.print = function (str) {}; |
@@ -132,3 +132,9 @@ var events = require('events'), | ||
// Run the topic, passing the previous context topics | ||
topic = topic.apply(ctx.env, ctx.topics); | ||
// If topic `throw`s an exception, pass it down as a value | ||
try { | ||
topic = topic.apply(ctx.env, ctx.topics); | ||
} | ||
catch (ex) { | ||
topic = ex; | ||
} | ||
@@ -167,3 +173,9 @@ if (typeof(topic) === 'undefined') { ctx._callback = true } | ||
} | ||
topic = ctx.emitter; | ||
// if I have a callback, push the new topic back up to | ||
// lastTopic | ||
if (ctx._callback) { | ||
lastTopic = topic = ctx.emitter; | ||
} else { | ||
topic = ctx.emitter; | ||
} | ||
} | ||
@@ -170,0 +182,0 @@ } |
@@ -12,5 +12,5 @@ { | ||
"directories" : { "test": "./test", "bin": "./bin" }, | ||
"version" : "0.6.0", | ||
"version" : "0.6.1", | ||
"scripts" : {"test": "./bin/vows --spec"}, | ||
"engines" : {"node": ">=0.2.6"} | ||
} |
@@ -13,3 +13,3 @@ var vows = require('../lib/vows'); | ||
}, | ||
"`length`": function () { | ||
"`lengthOf`": function () { | ||
assert.lengthOf("hello world", 11); | ||
@@ -16,0 +16,0 @@ assert.lengthOf([1, 2, 3], 3); |
@@ -174,2 +174,10 @@ var path = require('path'), | ||
}, | ||
"A topic with a function that errors": { | ||
topic: function() { | ||
throw("Something wrong here"); | ||
}, | ||
"should error out": function(topic) { | ||
assert.equal(topic, "Something wrong here"); | ||
} | ||
}, | ||
"A topic emitting an error": { | ||
@@ -488,1 +496,29 @@ topic: function () { | ||
}).export(module); | ||
vows.describe('Async topic is passed to vows with topic-less subcontext').addBatch({ | ||
'Async 42': { | ||
topic: function () { | ||
var callback = this.callback; | ||
process.nextTick(function () { | ||
callback(null, 42); | ||
}); | ||
}, | ||
'equals 42': function (topic) { | ||
assert.equal(topic, 42); | ||
}, | ||
'has the property that': { | ||
'it is equal to 42': function (topic) { | ||
// <-- This vow fails, topic is undefined!? | ||
assert.equal(topic, 42); | ||
} | ||
}, | ||
'plus 1': { | ||
topic: function (parentTopic) { | ||
return parentTopic + 1; | ||
}, | ||
'equals 43': function (topic) { | ||
assert.equal(topic, 43); | ||
} | ||
} | ||
} | ||
})['export'](module); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104795
2366