@domir/bun-test
v0.1.2
Published
A set of helpers for testing Effects with bun test
Readme
Introduction
Welcome to your guide on testing Effect-based applications using bun:test and the @domir/bun-test package. This package simplifies running tests for Effect-based code with Bun test.
In this guide, we'll walk you through setting up the necessary dependencies and provide examples of how to write Effect-based tests using @domir/bun-test.
Requirements
First, ensure you have bun installed (version 1.6.0 or later).
Next, install the @domir/bun-test package, which integrates Effect with Bun test.
bun add -D @domir/bun-testOverview
The main entry point is the following import:
import { it } from "@domir/bun-test"This import enhances the standard it function from bun:test with several powerful features, including:
| Feature | Description |
| --------------- | ------------------------------------------------------------------------------------------------------ |
| it.effect | Automatically injects a TestContext (e.g., TestClock) when running a test. |
| it.live | Runs the test with the live Effect environment. |
| it.scoped | Allows running an Effect program that requires a Scope. |
| it.scopedLive | Combines the features of scoped and live, using a live Effect environment that requires a Scope. |
| it.flakyTest | Facilitates the execution of tests that might occasionally fail. |
