effect.ts-testing

Mock Effect.ts services using Layer-based dependency injection in tests.

Updated Mar 11, 2026
One-click install
npx skills add https://github.com/Industrial/rust-symphony --skill effect-ts-testing-industrial
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect.ts-testing
Source: https://github.com/Industrial/rust-symphony/tree/main/.cursor/skills/effect.ts-testing
Command: npx skills add https://github.com/Industrial/rust-symphony --skill effect-ts-testing-industrial

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill teaches AI assistants how to properly test Effect.ts code, specifically addressing the common pitfall of using traditional mocking tools (vi.mock(), jest.mock()) which break Effect's dependency injection system.

Core Features & Use Cases

  • Correct Mocking: Demonstrates how to use Effect's Layer system for dependency injection in tests.
  • Avoids Mock Leakage: Ensures tests are isolated and don't interfere with each other.
  • Type Safety: Maintains TypeScript's type checking for mocks.
  • Use Case: Testing a function that makes an HTTP request using Effect.ts, by providing a mock HttpClient Layer instead of using vi.mock('@effect/platform').

Quick Start

Use the effect.ts-testing skill to learn how to mock an HttpClient service in your Effect.ts tests.

Frequently Asked Questions about effect.ts-testing

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

FAQPage Schema
How do I mock services in Effect.ts tests without breaking the dependency injection system?

Mock services in Effect.ts tests by providing mock implementations using the built-in Layer system. This approach maintains type safety and ensures proper dependency injection, avoiding the test isolation issues caused by module-level mocks.

Why does vi.mock() or jest.mock() break Effect.ts dependency injection?

Module-level mocking tools like vi.mock() or jest.mock() break Effect.ts dependency injection because they replace entire modules, bypassing the Layer system. Effect requires services to be injected through Layers to correctly manage dependencies and isolate tests.

What is the best way to test HttpClient requests in Effect.ts?

The best way to test HttpClient requests in Effect.ts is to provide a mock HttpClient Layer instead of mocking the platform module. This maintains type safety and correctly isolates the test environment using the built-in dependency injection system.

How do I test error cases and retry logic using Effect.ts Layers?

Test error cases and retry logic in Effect.ts by creating reusable mock Layer implementations that simulate failures. This allows you to verify that your code handles errors and retries correctly through the dependency injection system.

Can I use TypeScript type checking with Effect.ts mock implementations?

Yes, using Effect.ts Layers for mocking maintains TypeScript type checking for your mock implementations. This ensures that your mock services correctly match the interfaces of the real dependencies throughout your tests.