[英]What is wrong in my mocha test with .done()?
In my mocha test I have something like this 在我的摩卡咖啡测试中,我有这样的东西
it.only("diag", function(done) {
let data = null;
app.client.timeoutsAsyncScript(5000).executeAsync(function(data, done) {
console.log("START");
done();
});
});
In my application I can see that console.log has been done. 在我的应用程序中,我可以看到console.log已经完成。 But this function .done() was never called. 但是从未调用过此函数.done()。 Why ? 为什么呢 What could be wrong ? 有什么问题吗?
Thanks for the help! 谢谢您的帮助!
You have parameter with the same name "done" in your callback function. 您的回调函数中具有相同名称的参数“ done” 。 The variable from the local scope is used over the variable from outer scope. 来自本地作用域的变量被用于来自外部作用域的变量。 You can either remove it or rename it eg executeAsync(function(data, done2) { ...
您可以将其删除或重命名,例如executeAsync(function(data, done2) { ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.