For some reason, I can't seem to get vows.js sub-topics working in my real test-suite, but they work fine in a example file... can you spot my problem?
This works:
vows.describe('An Education in Vows').addBatch({
'when I write an asynchronous topic': {
topic: function() {
var that = this;
setTimeout(function() {
that.callback(true);
}, 100);
},
'it passes': function (topic) {
assert.equal(topic, true);
},
'and it has an asynchronous sub-topic': {
topic: function() {
var that = this;
setTimeout(function() {
that.callback(true);
}, 100);
},
'it also passes': function (topic) {
assert.equal(topic, true);
}
}
}
}).run();
When I run this via:
node tests/learning-vows.js
I get:
·
·
✓ OK » 2 honored (0.207s)
This Doesn't work:
I have a file ./tests/smoke.js
vows.describe('Registration & Authentication').addBatch({
'when a user registers with a valid username and password': {
topic: function () {
client.register({
username: validusername,
password: validpassword
}, this.callback);
},
'we return status 200 OK': function (data, response) {
assert.equal(200, response.statusCode);
},
'simple sub-topic': {
topic: true,
'should work': function(topic) {
assert.equal(true, topic);
}
},
}
}).run()
When I execute this via:
node tests/smoke.js
I get:
·
✗ Errored » 1 honored ∙ 1 errored
Note that in the second example, without the sub topic I get:
·
✓ OK » 1 honored (0.100s)