Constimport { Context, Effect, Layer } from "effect";
import { expect, layer } from "effect-playwright/test";
class Greeting extends Context.Service<Greeting, string>()("Greeting") {}
layer(Layer.succeed(Greeting, "hello"))("Greeting", (it) => {
it.effect("provides the layer", () =>
Effect.gen(function* () {
expect(yield* Greeting).toBe("hello");
}),
);
});
Shares an Effect
Layerbetween Playwright tests in the current worker.The layer is acquired before the tests in the block and released after all tests in the block finish. Passing a name wraps the tests in a Playwright
describeblock. Layers can be nested and reuse their parent services.