effect-patterns-testing

Consolidate Effect-TS testing best practices for clocks, services, and streams.

Updated Jan 24, 2026
One-click install
npx skills add https://github.com/scotttrinh/nook --skill effect-patterns-testing-scotttrinh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-patterns-testing
Source: https://github.com/scotttrinh/nook/tree/main/.agents/skills/effect-patterns-testing
Command: npx skills add https://github.com/scotttrinh/nook --skill effect-patterns-testing-scotttrinh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Effect-TS testing patterns can be hard to learn; this Skill consolidates best practices with curated examples across beginner to advanced levels, helping you write deterministic tests for effects, clocks, services, and streams.

Core Features & Use Cases

  • Beginner patterns: Basic coverage for running effects in tests, asserting results, and writing simple testable programs.
  • Intermediate patterns: Deterministic testing with Clock, service dependencies, and layered composition.
  • Advanced patterns: Organizing layers into composable modules, stream testing, and realistic end-to-end scenarios.
  • Use Case: Validate a small Effect-based utility in isolation, then swap in test doubles for dependencies.

Quick Start

Create a small TypeScript test that demonstrates running Effect.runPromise on a simple Effect and asserting the result. Install Vitest (or your preferred test runner), set up a test file, import Effect, and verify a basic program.

Frequently Asked Questions about effect-patterns-testing

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

FAQPage Schema
How do I write deterministic unit tests for Effect-TS programs?

To write deterministic Effect-TS tests, you use curated patterns for controlling clocks, swapping service dependencies with test doubles, and composing modular layers. This approach ensures your effects run predictably across beginner to advanced scenarios.

What is the best way to test Effect-TS services and streams?

Testing Effect-TS services and streams involves organizing layers into composable modules and applying specialized stream testing patterns. This allows you to validate dependencies and complex data flows in realistic, end-to-end scenarios.

Can I use Vitest to run and assert Effect-TS test results?

Yes, you can use Vitest to run Effect-TS programs by calling Effect.runPromise on a simple Effect and asserting the result. The testing patterns apply across common test runners, allowing you to validate isolated utilities effectively.

Do I need dependency injection to test Effect-TS codebases effectively?

Yes, dependency injection is required to test Effect-TS codebases effectively. By swapping in test doubles for service dependencies and using layered composition, you isolate components and validate small utilities without triggering real-world side effects.

How does layered composition work when testing Effect-TS applications?

Layered composition in Effect-TS testing works by organizing modular layers into composable modules. This structure allows you to build deterministic test environments, swap service dependencies, and validate complex streams across real-world codebases.

Why are my Effect-TS tests failing due to non-deterministic clocks?

Effect-TS tests fail due to non-deterministic clocks when real time is used. You fix this by applying intermediate testing patterns that control the Clock, ensuring deterministic service dependencies and predictable effect execution.