effect-testing

Creates deterministic vitest suites for Effect-based code using layers, TestClock, and error assertions.

22|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-testing-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-testing
Source: https://github.com/mpsuesser/pi-effect-harness/tree/main/harnesses/effect/skills/effect-testing
Command: npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-testing-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Testing Effect-based code can be slow, flaky, and hard to reason about when time, services, and error channels are involved.

Core Features & Use Cases

  • Deterministic testing with @effect/vitest: choose the right runner (it.effect vs it.live) so time and randomness behave correctly.
  • Correct dependency injection with Layers: provide real services or mocked layers with clear scope and composition.
  • Time-dependent testing with TestClock: advance time instantly to avoid sleeps and hanging tests.
  • Robust error & failure assertions: validate failures using Effect.flip, Effect.exit, and error-cause inspection.
  • Property-based testing: use it.prop and it.effect.prop to cover behaviors across many generated cases.
  • Protocol-level testing guidance: prefer HTTP mock server tests for HTTP/SSE behavior over service fakes when transport correctness matters.

Quick Start

Use the effect-testing skill to help you write comprehensive tests for your Effect-based module using @effect/vitest and vitest, including time simulation with TestClock and Layer-provided dependencies.

Frequently Asked Questions about effect-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test asynchronous Effect code deterministically without flaky sleeps?

Testing Effect layers in vitest requires constructing mock or real services and providing them via Layers with clear scope and composition. This ensures correct dependency injection and isolates the system under test from external side effects.

When should I use it.live vs it.effect for testing Effect services?

Use it.live for real-time asynchronous behavior and it.effect when you need deterministic control over time and randomness via TestClock. Selecting the proper environment ensures your Effect tests validate correctness without uncontrolled external factors.

How do I assert on Effect failure channels and error causes in vitest?

Cover generated Effect cases by applying property-based testing with it.prop and it.effect.prop. This validates behaviors across many generated inputs, ensuring your property-based invariants hold true for asynchronous Effects and STM/CRDT operations.

What is the best way to test HTTP and SSE protocol flows in Effect?

To test HTTP and SSE protocol flows in Effect, prefer using HTTP mock server tests over service fakes. This approach maintains transport correctness, allowing you to validate protocol-level behavior accurately within your vitest test suite.