askill
effect-testing

effect-testingSafety 90Repository

Use when writing tests for Effect.ts code

3 stars
1.2k downloads
Updated 2/28/2026

Package Files

Loading files...
SKILL.md

Error Testing

test.it("should fail with ValidationError", async () => {
  const program = Effect.gen(function* () {
    const result = yield* Effect.exit(operation("invalid"))

    if (result._tag === "Failure") {
      test.expect(ValidationError.isValidationError(result.cause)).toBe(true)
      const error = result.cause as ValidationError
      test.expect(error.field).toBe("input")
    } else {
      test.fail("Expected operation to fail")
    }
  })

  await Effect.runPromise(program)
})

Time-sensitive Testing

import * as TestClock from "effect/TestClock"

test.it("should handle delay", async () => {
  const program = Effect.gen(function* () {
    const fiber = yield* Effect.fork(
      Effect.gen(function* () {
        yield* Effect.sleep("5 seconds")
        return "completed"
      }),
    )

    // Advance test clock (not wall clock)
    yield* TestClock.adjust("5 seconds")

    const result = yield* Effect.Fiber.join(fiber)
    return result
  })

  const result = await Effect.runPromise(program)
  test.expect(result).toBe("completed")
})

Commands

tsc                # Type check
bun test <file>    # Test specific file
bun test           # All tests

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

67/100Analyzed 3/2/2026

A focused skill for testing Effect.ts code with practical examples for error testing and time-sensitive testing using TestClock. Includes run commands. Missing trigger section, setup context, and is relatively short. Good for developers already familiar with Effect.ts who need quick testing reference."

90
70
72
58
68

Metadata

Licenseunknown
Version-
Updated2/28/2026
Publishernounder

Tags

testing