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

TestServices.ts overview

Since v2.0.0


Exports Grouped by Category


utils

TestServices (type alias)

Signature

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

Source

Since v2.0.0

annotate

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

Signature

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

Source

Since v2.0.0

annotations

Retrieves the Annotations service for this test.

Signature

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

Source

Since v2.0.0

annotationsLayer

Constructs a new Annotations service wrapped in a layer.

Signature

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

Source

Since v2.0.0

annotationsWith

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

Signature

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

Source

Since v2.0.0

currentServices

Signature

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

Source

Since 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

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

Source

Since v2.0.0

live

Retrieves the Live service for this test.

Signature

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

Source

Since v2.0.0

liveLayer

Constructs a new Live service wrapped in a layer.

Signature

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

Source

Since v2.0.0

liveServices

The default Effect test services.

Signature

declare const liveServices: Context.Context<TestServices>

Source

Since v2.0.0

liveWith

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

Signature

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

Source

Since v2.0.0

provideLive

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

Signature

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

Source

Since 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

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>)

Source

Since v2.0.0

repeats

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

Signature

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

Source

Since v2.0.0

retries

The number of times to retry flaky tests.

Signature

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

Source

Since v2.0.0

samples

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

Signature

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

Source

Since v2.0.0

shrinks

The maximum number of shrinkings to minimize large failures.

Signature

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

Source

Since v2.0.0

size

Signature

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

Source

Since v2.0.0

sized

Retrieves the Sized service for this test.

Signature

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

Source

Since v2.0.0

sizedLayer

Signature

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

Source

Since v2.0.0

sizedWith

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

Signature

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

Source

Since v2.0.0

supervisedFibers

Returns the set of all fibers in this test.

Signature

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

Source

Since v2.0.0

testConfig

Retrieves the TestConfig service for this test.

Signature

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

Source

Since v2.0.0

testConfigLayer

Constructs a new TestConfig service with the specified settings.

Signature

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

Source

Since v2.0.0

testConfigWith

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

Signature

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

Source

Since v2.0.0

withAnnotations

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

Signature

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>)

Source

Since 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

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

Source

Since v2.0.0

withLive

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

Signature

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>)

Source

Since 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

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

Source

Since v2.0.0

withSize

Signature

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>)

Source

Since v2.0.0

withSized

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

Signature

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>)

Source

Since 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

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

Source

Since v2.0.0

withTestConfig

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

Signature

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>)

Source

Since 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

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

Source

Since v2.0.0