Installation
Basic Usage
Import the enhancedit function from @effect/vitest:
Testing Effects
Useit.effect to write tests for Effect programs:
Testing Success and Failure
UseEffect.exit to test both success and failure cases:
Test Clock
it.effect automatically provides a TestContext with a TestClock for simulating time:
Live Environment
Useit.live to run tests with the real-time clock:
Scoped Tests
Useit.scoped for tests that require resource management:
Layer Testing
Share layers between tests usingit.layer:
Nested Layers
Layers can be nested for more complex test scenarios:Property-Based Testing
Useit.prop for property-based testing with FastCheck:
Flaky Tests
Handle tests that may occasionally fail:Test Modifiers
Skip Tests
Run Only Specific Tests
Skip Conditionally
Run Conditionally
Expect Failure
Parameterized Tests
Run the same test with different inputs:Logging in Tests
By default, logs are suppressed. Enable them when needed:Equality Testers
Add custom equality testers for Effect types:API Reference
- it.effect: Test Effect programs with TestContext
- it.live: Test with live environment (real time)
- it.scoped: Test with Scope for resource management
- it.layer: Share layers between tests
- it.prop: Property-based testing
- flakyTest: Retry tests until success or timeout
- addEqualityTesters: Add Effect equality testers to Vitest
