【发布时间】:2016-05-28 02:35:21
【问题描述】:
好吧,我显然是摩卡的新手。根据我阅读文档和谷歌搜索后的理解,这应该可行,但不是:
describe("Check before", function(){
var beforeCalled = false;
before(function(){
setTimeout(function() {
beforeCalled = true;
done();
}, 150);
});
it("should run after before called", function(){
expect(beforeCalled).to.equal(true);
})
})
it 部分不会等待“之前”完成并被调用。也许我读错了文档或者我遗漏了一些东西,不确定。
任何见解都会有所帮助。
【问题讨论】:
标签: node.js unit-testing mocha.js chai