Introduction
Welcome 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
.
Requirements
First, ensure you have @rstest/core
installed.
Next, install the @domir/rstest
package, which integrates Effect with rstest.
bun add -D @domir/rstest
Overview
The main entry point is the following import:
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. |