How to call await inside mocha root hook plugin

Viewed 249

I am using the mocha root hook plugin as this piece of code:

exports.mochaHooks = {
    beforeEach(done) {
        some code
        done();
    },
 };

But now I need to await an async function inside the beforeEach block. How can I do this?

1 Answers

The syntaxis is as follow:

beforeEach(async () => {
    await doSomething()
})
Related