A set of helpers for testing Effects with rstest test
npm install @domir/rstestWelcome to your guide on testing Effect-based applications using @rstest/core and the @domir/rstest package. This package simplifies running tests for Effect-based code with rstest.
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/rstest.
First, ensure you have @rstest/core installed.
Next, install the @domir/rstest package, which integrates Effect with rstest.
``sh`
bun add -D @domir/rstest
The main entry point is the following import:
`ts`
import { it } from "@domir/rstest"
This import enhances the standard it function from @rstest/core 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. |