Lab + TypeScript = 😍
Take the @hapi/lab you know and love and add a sprinkling of built-in TypeScript support and out comes ts-lab, an opinionated spin on vanilla lab.
See @hapi/lab on the official Hapi developer site for more information on Lab itself.
Differences
ts-lab is not a fork of @hapi/lab but instead wraps it. At the time of writing, the justification for this decision isn't entirely clear but here we are. This repo exposes a binary ts-lab that forwards arguments to the lab binary exposed by @hapi/lab with the addition of arguments to add TypeScript support. The module also exposes an API that wraps @hapi/lab's API. The differences are outlined below:
- Out-of-the-box support for tests authored in TypeScript.
- Exposes an instance of
@hapi/code's assertion library as the top-level expect export.
- Changes the optional
flags arguments passed into test functions such that:
- It no longer exports a mutable
.onCleanup property.
- Exports a
.disposeOf(disposable: { dispose(): void }): void function. This can be used to register multiple disposables for disposal during the test's clean-up phase.
License
See LICENSE.md.