0.1.2 • Published 5 years ago

tape-await v0.1.2

Weekly downloads
217
License
ISC
Repository
github
Last release
5 years ago

tape-await

A synchronous test without test.end:

tape("42 is a number", test => {
  test.equal(typeof 42, "number");
});

A synchronous test that throws an error which is treated as a failure:

tape("errors are failures", test => {
  throw new Error("fail");
});

An asynchronous test:

tape("promises are great", async test => {
  await new Promise(resolve => setTimeout(resolve, 250));
  test.ok(true);
});

This module is similar to tape-async, tape-promise, and blue-tape. One difference is that it also provides implicit test.end for synchronous tests, rather than only providing it for asynchronous tests. Another is that it correctly handles rejected promises with falsey values, such as Promise.reject(). Also, it only supports promises and not generators, and does not attempt to deal with unhandled promise rejections or uncaught exceptions.