Skip to main content Link Search Menu Expand Document (external link)

TestServices overview

Added in v2.0.0


Table of contents


utils

TestServices (type alias)

Signature

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

Added in v2.0.0

annotate

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

Signature

export declare const annotate: <A>(key: TestAnnotation.TestAnnotation<A>, value: A) => Effect.Effect<void>

Added in v2.0.0

annotations

Retrieves the Annotations service for this test.

Signature

export declare const annotations: () => Effect.Effect<Annotations.TestAnnotations>

Added in v2.0.0

annotationsLayer

Constructs a new Annotations service wrapped in a layer.

Signature

export declare const annotationsLayer: () => Layer.Layer<Annotations.TestAnnotations>

Added in v2.0.0

annotationsWith

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

Signature

export declare const annotationsWith: <A, E, R>(
  f: (annotations: Annotations.TestAnnotations) => Effect.Effect<A, E, R>
) => Effect.Effect<A, E, R>

Added in v2.0.0

currentServices

Signature

export declare const currentServices: FiberRef.FiberRef<Context.Context<TestServices>>

Added in v2.0.0

get

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

Signature

export declare const get: <A>(key: TestAnnotation.TestAnnotation<A>) => Effect.Effect<A, never, never>

Added in v2.0.0

live

Retrieves the Live service for this test.

Signature

export declare const live: Effect.Effect<Live.TestLive, never, never>

Added in v2.0.0

liveLayer

Constructs a new Live service wrapped in a layer.

Signature

export declare const liveLayer: () => Layer.Layer<Live.TestLive, never, DefaultServices.DefaultServices>

Added in v2.0.0

liveServices

The default Effect test services.

Signature

export declare const liveServices: Context.Context<TestServices>

Added in v2.0.0

liveWith

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

Signature

export declare const liveWith: <A, E, R>(f: (live: Live.TestLive) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>

Added in v2.0.0

provideLive

Provides a workflow with the “live” default Effect services.

Signature

export declare const provideLive: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>

Added in v2.0.0

provideWithLive

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

Signature

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

Added in v2.0.0

repeats

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

Signature

export declare const repeats: Effect.Effect<number, never, never>

Added in v2.0.0

retries

The number of times to retry flaky tests.

Signature

export declare const retries: Effect.Effect<number, never, never>

Added in v2.0.0

samples

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

Signature

export declare const samples: Effect.Effect<number, never, never>

Added in v2.0.0

shrinks

The maximum number of shrinkings to minimize large failures.

Signature

export declare const shrinks: Effect.Effect<number, never, never>

Added in v2.0.0

size

Signature

export declare const size: Effect.Effect<number, never, never>

Added in v2.0.0

sized

Retrieves the Sized service for this test.

Signature

export declare const sized: Effect.Effect<Sized.TestSized, never, never>

Added in v2.0.0

sizedLayer

Signature

export declare const sizedLayer: (size: number) => Layer.Layer<Sized.TestSized>

Added in v2.0.0

sizedWith

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

Signature

export declare const sizedWith: <A, E, R>(
  f: (sized: Sized.TestSized) => Effect.Effect<A, E, R>
) => Effect.Effect<A, E, R>

Added in v2.0.0

supervisedFibers

Returns the set of all fibers in this test.

Signature

export declare const supervisedFibers: () => Effect.Effect<SortedSet.SortedSet<Fiber.RuntimeFiber<unknown, unknown>>>

Added in v2.0.0

testConfig

Retrieves the TestConfig service for this test.

Signature

export declare const testConfig: Effect.Effect<TestConfig.TestConfig, never, never>

Added in v2.0.0

testConfigLayer

Constructs a new TestConfig service with the specified settings.

Signature

export declare const testConfigLayer: (params: {
  readonly repeats: number
  readonly retries: number
  readonly samples: number
  readonly shrinks: number
}) => Layer.Layer<TestConfig.TestConfig>

Added in v2.0.0

testConfigWith

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

Signature

export declare const testConfigWith: <A, E, R>(
  f: (config: TestConfig.TestConfig) => Effect.Effect<A, E, R>
) => Effect.Effect<A, E, R>

Added in v2.0.0

withAnnotations

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

Signature

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

Added in v2.0.0

withAnnotationsScoped

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

Signature

export declare const withAnnotationsScoped: (
  annotations: Annotations.TestAnnotations
) => Effect.Effect<void, never, Scope.Scope>

Added in v2.0.0

withLive

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

Signature

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

Added in v2.0.0

withLiveScoped

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

Signature

export declare const withLiveScoped: (live: Live.TestLive) => Effect.Effect<void, never, Scope.Scope>

Added in v2.0.0

withSize

Signature

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

Added in v2.0.0

withSized

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

Signature

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

Added in v2.0.0

withSizedScoped

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

Signature

export declare const withSizedScoped: (sized: Sized.TestSized) => Effect.Effect<void, never, Scope.Scope>

Added in v2.0.0

withTestConfig

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

Signature

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

Added in v2.0.0

withTestConfigScoped

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

Signature

export declare const withTestConfigScoped: (config: TestConfig.TestConfig) => Effect.Effect<void, never, Scope.Scope>

Added in v2.0.0