/** * @since 0.1.0 */ import type * as Duration from "effect/Duration" import type * as Effect from "effect/Effect" import type * as FC from "effect/FastCheck" import type * as Layer from "effect/Layer" import type * as Schema from "effect/Schema" import type * as Scope from "effect/Scope" import type * as TestServices from "effect/TestServices" /** * Public types for the Effect-enabled Bun test API. * @since 0.1.0 */ export namespace BunTest { /** A test function that returns an Effect. */ export interface TestFunction> { (...args: TestArgs): Effect.Effect } /** Basic test interface for creating Effect-based tests. */ export interface Test { ( name: string, self: TestFunction, timeout?: number ): void } /** Arbitraries used by property tests. */ export type Arbitraries = | Array> | { [K in string]: Schema.Schema.Any | FC.Arbitrary } /** Extended test interface with modifiers and utilities. */ export interface Tester extends BunTest.Test { skip: BunTest.Test skipIf: (condition: unknown) => BunTest.Test runIf: (condition: unknown) => BunTest.Test only: BunTest.Test each: ( cases: ReadonlyArray ) => (name: string, self: TestFunction, timeout?: number) => void failing: BunTest.Test todo: BunTest.Test prop: ( name: string, arbitraries: Arbs, self: TestFunction< A, E, R, [{ [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary ? T : Schema.Schema.Type }] >, timeout?: number | { timeout?: number fastCheck?: FC.Parameters< { [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary ? T : Schema.Schema.Type } > } ) => void } /** Complete test methods interface including Effect utilities. */ export interface Methods { readonly effect: BunTest.Tester readonly flakyTest: ( self: Effect.Effect, timeout?: Duration.DurationInput ) => Effect.Effect readonly scoped: BunTest.Tester readonly live: BunTest.Tester readonly scopedLive: BunTest.Tester readonly layer: ( layer_: Layer.Layer, options?: { readonly memoMap?: Layer.MemoMap; readonly timeout?: Duration.DurationInput } ) => { (f: (it: BunTest.Methods) => void): void (name: string, f: (it: BunTest.Methods) => void): void } readonly prop: BunTest.Tester["prop"] } }