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

TestAnnotations overview

Added in v2.0.0


Table of contents


utils

TestAnnotations

Signature

export declare const TestAnnotations: Context.Tag<TestAnnotations, TestAnnotations>

Added in v2.0.0

TestAnnotations (interface)

The Annotations trait provides access to an annotation map that tests can add arbitrary annotations to. Each annotation consists of a string identifier, an initial value, and a function for combining two values. Annotations form monoids and you can think of Annotations as a more structured logging service or as a super polymorphic version of the writer monad effect.

Signature

export interface TestAnnotations {
  readonly [TestAnnotationsTypeId]: TestAnnotationsTypeId

  /**
   * A ref containing the bacnking map for all annotations
   */
  readonly ref: Ref.Ref<TestAnnotationMap.TestAnnotationMap>

  /**
   * Accesses an `Annotations` instance in the context and retrieves the
   * annotation of the specified type, or its default value if there is none.
   */
  get<A>(key: TestAnnotation.TestAnnotation<A>): Effect.Effect<A>

  /**
   * Accesses an `Annotations` instance in the context and appends the
   * specified annotation to the annotation map.
   */
  annotate<A>(key: TestAnnotation.TestAnnotation<A>, value: A): Effect.Effect<void>

  /**
   * Returns the set of all fibers in this test.
   */
  readonly supervisedFibers: Effect.Effect<SortedSet.SortedSet<Fiber.RuntimeFiber<unknown, unknown>>>
}

Added in v2.0.0

TestAnnotationsTypeId

Signature

export declare const TestAnnotationsTypeId: typeof TestAnnotationsTypeId

Added in v2.0.0

TestAnnotationsTypeId (type alias)

Signature

export type TestAnnotationsTypeId = typeof TestAnnotationsTypeId

Added in v2.0.0

isTestAnnotations

Signature

export declare const isTestAnnotations: (u: unknown) => u is TestAnnotations

Added in v2.0.0

make

Signature

export declare const make: (ref: Ref.Ref<TestAnnotationMap.TestAnnotationMap>) => TestAnnotations

Added in v2.0.0