index
Other
addEqualityTesters
Added in v4.0.0
Source
Signature
declare const addEqualityTesters: () => void;Signature
type API = V.TestAPI<{}>;describeWrapped
Added in v4.0.0
Source
Signature
declare const describeWrapped: (name: string, f: (it: Vitest.Methods) => void) => V.SuiteCollector;Signature
declare const effect: Vitest.Tester<Scope.Scope>;Signature
declare const flakyTest: <A, E, R>(
self: Effect.Effect<A, E, R | Scope.Scope>,
timeout?: Duration.Input,
) => Effect.Effect<A, never, R>;Signature
declare const it: Vitest.Methods;layer
Added in v4.0.0
```ts
import { assert, layer } from "@effect/vitest"
import { Effect, Layer, Context } from "effect"
class Foo extends Context.Service<Foo, "foo">()("Foo") {
static Live = Layer.succeed(Foo, "foo")
}
class Bar extends Context.Service<Bar, "bar">()("Bar") {
static Live = Layer.effect(
Bar,
Effect.map(Foo, () => "bar" as const)
)
}
layer(Foo.Live)("layer", (it) => {
it.effect("adds context", () =>
Effect.gen(function*() {
const foo = yield* Foo
assert.strictEqual(foo, "foo")
}))
it.layer(Bar.Live)("nested", (it) => {
it.effect("adds context", () =>
Effect.gen(function*() {
const foo = yield* Foo
const bar = yield* Bar
assert.strictEqual(foo, "foo")
assert.strictEqual(bar, "bar")
}))
})
})
```
Source
Signature
declare const layer: <R, E>(
layer_: Layer.Layer<R, E>,
options?: {
readonly excludeTestServices?: boolean;
readonly memoMap?: Layer.MemoMap;
readonly timeout?: Duration.Input;
},
) => {
(f: (it: MethodsNonLive<R>) => void): void;
(name: string, f: (it: MethodsNonLive<R>) => void): void;
};Signature
declare const live: Vitest.Tester<Scope.Scope>;makeMethods
Added in v4.0.0
Source
Signature
declare const makeMethods: (it: V.TestAPI) => Vitest.Methods;Signature
declare const prop: Vitest.Methods["prop"];
Share a
Layerbetween multiple tests, optionally wrapping the tests in adescribeblock if a name is provided.