是否可以与摩卡同步调用测试用例?例如,我有下面的代码: context('Context of test suite',() => {
it('test case name',() => {
//call expect() a few times
})
})
console.log('foo')
我要运行它,但我要保证foo将不被打印后,才测试用例已经执行,要
考虑下面的函数,用摩卡 function helloAfter100ms(){
setTimeout(function(){
console.log('hello');
},100)
}
测试代码, describe('#helloAfter100ms()',function(){
it('console logs hello ONLY after 1
我的快递服务器会引发一个错误,如果有参数缺失(例如,DB URI)。我想在摩卡测试它实际上抛出了错误,但我不知道如何让摩卡能做到这一点。 if(!parameters.db) {
throw new Error('Please provide a db URI');
}
我有一个测试的设置是这样的: it('Throws Error when no db URI provided
我有一个Express服务器,我正在使用Passport-local进行身份验证。我有以下受保护的路线: app.post("/api/test", connect.ensureLoggedIn("/"), (req, res) => {
let test = new Test(req.body);
test
.save()
.then(data => {
re