0
出于某种原因,我似乎无法获得vows.js子主题在我的真实测试套件中工作,但它们在示例文件中工作正常......可以发现我的问题吗?我使用vows.js子主题有什么问题?
这工作:
node tests/learning-vows.js
我得到:
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();
当我通过运行这个
·
·
✓ OK » 2 honored (0.207s)
这不起作用:
我有一个文件./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()
当我通过执行此:
node tests/smoke.js
我得到:
·
✗ Errored » 1 honored ∙ 1 errored
注意的是,在第二个例子中,没有子话题,我得到:
·
✓ OK » 1 honored (0.100s)
你尝试和'console.log'你上次'assert.equal'就是测试作为话题? – Floby 2013-03-05 15:01:47
如果不是'topic:true,'你做了'topic:function(){return true; }' – Pointy 2013-03-05 15:02:22