我的目标只是在创建一个帐户的过程中运行一个测试。我有以下代码:
require( "./../..这导致摩卡测试失败,给了我:Error: Timeout of 2000ms exceeded.For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.decoded = jwt.verify( token, process
在我们的mocha测试中,有时我们有bug和抛出异常,当这些异常被抛出时,后续的断言不会被调用,我们的测试可能会通过,即使有一些错误。fail, such as the 1,2 case above, the line number of the error is not shown }); 但是catch案例隐藏了一些失败的断言信息
我在我的项目中有一个功能,可以一个接一个地发送一堆电子邮件。因此,我将这些列表编译成一个promises数组,并使用Promise.all(...)将它们全部发送出去,然后结束函数。然而,我将对此进行测试,似乎Promise正在“吞下”我的错误。在我的测试中,我有这样的代码(它调用前面的代码片段)
it('sends loan emails to appropriate users if there is a email to send today:,而不是由mocha
我正在尝试使用Mocha,Chai和Sinon在我的代码中添加更多的测试,但是我很难理解为什么第二个存根函数没有被识别为被调用。我有一个向用户发送电子邮件的函数(稍后我将测试电子邮件功能--现在我只想处理我控制的存根依赖项)const models = require('..userData.id); } else {
emailLogger.log('Send to anon - no user foun