简体   繁体   中英

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. But this function .done() was never called. Why ? What could be wrong ?

Thanks for the help!

You have parameter with the same name "done" in your callback function. 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) { ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM