Skip to content

Yet another async-await helper for tape.

License

Notifications You must be signed in to change notification settings

jashkenas/tape-await

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Yet another async-await helper for tape.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%