Syntax for an async arrow function

Async arrow functions look like this: Async arrow functions look like this for a single argument passed to it: Async arrow functions look like this for multiple arguments passed to it: The anonymous form works as well: An async function declaration looks like this: Using async function in a callback: Using async method inside of a class:

Getting a UnhandledPromiseRejectionWarning when testing using mocha/chai

The issue is caused by this: If the assertion fails, it will throw an error. This error will cause done() never to get called, because the code errored out before it. That’s what causes the timeout. The “Unhandled promise rejection” is also caused by the failed assertion, because if an error is thrown in a … Read more

Getting a UnhandledPromiseRejectionWarning when testing using mocha/chai

The issue is caused by this: If the assertion fails, it will throw an error. This error will cause done() never to get called, because the code errored out before it. That’s what causes the timeout. The “Unhandled promise rejection” is also caused by the failed assertion, because if an error is thrown in a … Read more