method Assert.prototype.async
Assert.prototype.async(): () => void

Returns a done callback for callback-style async tests. The test will not finish until every done callback returned by async() has been called.

For async/await tests prefer async (assert) => { ... } directly.

Examples

Example 1

test("async callback style", (assert) => {
  const done = assert.async();
  setTimeout(() => {
    assert.ok(true, "async callback ran");
    done();
  }, 10);
});

Return Type

() => void

A callback to invoke when the async work finishes.

Usage

import { Assert } from ".";