Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

TestServices

34 exports Since v2.0.0 Source

Other

Since v2.0.0

Accesses an Annotations instance in the context and appends the specified annotation to the annotation map.

Signature

declare function annotate<A>(key: TestAnnotation<A>, value: A): Effect<void>

Retrieves the Annotations service for this test.

Signature

declare function annotations(): Effect<TestAnnotations>

Constructs a new Annotations service wrapped in a layer.

Signature

declare function annotationsLayer(): Layer<TestAnnotations>

Retrieves the Annotations service for this test and uses it to run the specified workflow.

Signature

declare function annotationsWith<A, E, R>(f: (annotations: TestAnnotations) => Effect<A, E, R>): Effect<A, E, R>

Signature

declare const currentServices: FiberRef.FiberRef<Context.Context<TestServices>>
Since v2.0.0

Accesses an Annotations instance in the context and retrieves the annotation of the specified type, or its default value if there is none.

Signature

declare function get<A>(key: TestAnnotation<A>): Effect<A>
Since v2.0.0

Retrieves the Live service for this test.

Signature

declare const live: Effect.Effect<Live.TestLive>

Constructs a new Live service wrapped in a layer.

Signature

declare function liveLayer(): Layer<TestLive, never, DefaultServices>

The default Effect test services.

Signature

declare const liveServices: Context.Context<TestServices>
Since v2.0.0

Retrieves the Live service for this test and uses it to run the specified workflow.

Signature

declare function liveWith<A, E, R>(f: (live: TestLive) => Effect<A, E, R>): Effect<A, E, R>

Provides a workflow with the "live" default Effect services.

Signature

declare function provideLive<A, E, R>(effect: Effect<A, E, R>): Effect<A, E, R>

Runs a transformation function with the live default Effect services while ensuring that the workflow itself is run with the test services.

Signature

declare const provideWithLive: <A, E, R, A2, E2, R2>(f: (effect: Effect<A, E, R>) => Effect<A2, E2, R2>) => (self: Effect<A, E, R>) => Effect<A2, E | E2, R | R2> & <A, E, R, A2, E2, R2>(self: Effect<A, E, R>, f: (effect: Effect<A, E, R>) => Effect<A2, E2, R2>) => Effect<A2, E | E2, R | R2>
Since v2.0.0

The number of times to repeat tests to ensure they are stable.

Signature

declare const repeats: Effect.Effect<number>
Since v2.0.0

The number of times to retry flaky tests.

Signature

declare const retries: Effect.Effect<number>
Since v2.0.0

The number of sufficient samples to check for a random variable.

Signature

declare const samples: Effect.Effect<number>
Since v2.0.0

The maximum number of shrinkings to minimize large failures.

Signature

declare const shrinks: Effect.Effect<number>
Since v2.0.0

Signature

declare const size: Effect.Effect<number>
Since v2.0.0

Retrieves the Sized service for this test.

Signature

declare const sized: Effect.Effect<Sized.TestSized>

Signature

declare function sizedLayer(size: number): Layer<TestSized>

Retrieves the Sized service for this test and uses it to run the specified workflow.

Signature

declare function sizedWith<A, E, R>(f: (sized: TestSized) => Effect<A, E, R>): Effect<A, E, R>

Returns the set of all fibers in this test.

Signature

declare function supervisedFibers(): Effect<SortedSet<RuntimeFiber<unknown, unknown>>>

Retrieves the TestConfig service for this test.

Signature

declare const testConfig: Effect.Effect<TestConfig.TestConfig>

Constructs a new TestConfig service with the specified settings.

Signature

declare function testConfigLayer(params: {
readonly repeats: number;
readonly retries: number;
readonly samples: number;
readonly shrinks: number;
}): Layer<TestConfig>

Retrieves the TestConfig service for this test and uses it to run the specified workflow.

Signature

declare function testConfigWith<A, E, R>(f: (config: TestConfig) => Effect<A, E, R>): Effect<A, E, R>
Since v2.0.0

Signature

type TestServices = Annotations.TestAnnotations | Live.TestLive | Sized.TestSized | TestConfig.TestConfig

Executes the specified workflow with the specified implementation of the annotations service.

Signature

declare const withAnnotations: (annotations: TestAnnotations) => <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R> & <A, E, R>(effect: Effect<A, E, R>, annotations: TestAnnotations) => Effect<A, E, R>

Sets the implementation of the annotations service to the specified value and restores it to its original value when the scope is closed.

Signature

declare function withAnnotationsScoped(annotations: TestAnnotations): Effect<void, never, Scope>
Since v2.0.0

Executes the specified workflow with the specified implementation of the live service.

Signature

declare const withLive: (live: TestLive) => <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R> & <A, E, R>(effect: Effect<A, E, R>, live: TestLive) => Effect<A, E, R>

Sets the implementation of the live service to the specified value and restores it to its original value when the scope is closed.

Signature

declare function withLiveScoped(live: TestLive): Effect<void, never, Scope>
Since v2.0.0

Signature

declare const withSize: (size: number) => <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R> & <A, E, R>(effect: Effect<A, E, R>, size: number) => Effect<A, E, R>

Executes the specified workflow with the specified implementation of the sized service.

Signature

declare const withSized: (sized: TestSized) => <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R> & <A, E, R>(effect: Effect<A, E, R>, sized: TestSized) => Effect<A, E, R>

Sets the implementation of the sized service to the specified value and restores it to its original value when the scope is closed.

Signature

declare function withSizedScoped(sized: TestSized): Effect<void, never, Scope>

Executes the specified workflow with the specified implementation of the config service.

Signature

declare const withTestConfig: (config: TestConfig) => <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R> & <A, E, R>(effect: Effect<A, E, R>, config: TestConfig) => Effect<A, E, R>

Sets the implementation of the config service to the specified value and restores it to its original value when the scope is closed.

Signature

declare function withTestConfigScoped(config: TestConfig): Effect<void, never, Scope>