import { AbstractTestContextFixture, type TestContextFactory } from './shared'; /** * Abstract base class for wrapping an existing test fixture to add additional context or behavior. * * Subclasses extend this to provide a richer test API while delegating to the underlying fixture. */ export declare abstract class AbstractWrappedFixture { readonly fixture: F; constructor(fixture: F); } /** * Abstract base class for a wrapped fixture that also manages its own test instance. * * Combines fixture wrapping with per-test instance lifecycle management from {@link AbstractTestContextFixture}. */ export declare abstract class AbstractWrappedFixtureWithInstance extends AbstractTestContextFixture { readonly parent: F; constructor(parent: F); } /** * Used to wrap a TestContextFactory of one fixture type to another. * * This is useful for cases where the base fixture may be used in a lot of places and contexts, but the wrapped version can configure * tests more specifically. */ export type TestWrappedContextFactoryBuilder = (factory: TestContextFactory) => TestContextFactory; export interface WrapTestContextConfig { /** * Wraps the fixture. This occurs once before any tests execute. */ wrapFixture: (fixture: F) => W; /** * Use for doing any setup that may be required on a per-test basis. * * This occurs before every test, but after the fixture's instance has already been configured. * * The setup can return an effect. This effect is passed to the teardown function later, if provided. */ setupWrap?: (wrap: W) => Promise; /** * Use for cleaning up the instance before the next function. * * This occurs after every test, but after the fixture's instance has already been configured. */ teardownWrap?: (wrap: W, effect: E) => Promise; } /** * Wraps the input TestContextFactory to emit another type of Fixture for tests. * * @param config - configuration specifying how to wrap fixtures and optional setup/teardown hooks * @returns a function that transforms a {@link TestContextFactory} of type `F` into one of type `W` */ export declare function wrapTestContextFactory(config: WrapTestContextConfig): (factory: TestContextFactory) => TestContextFactory; export interface InstanceWrapTestContextConfig, F> extends Pick, 'wrapFixture'> { /** * Creates a new instance for the tests. */ makeInstance: (wrap: W) => I | Promise; /** * Use for doing any setup that may be required on a per-test basis. * * This occurs before every test, but after the fixture's instance has already been configured. */ setupInstance?: (instance: I, wrap: W) => void | Promise; /** * Use for cleaning up the instance before the next function. * * This occurs after every test, but after the fixture's instance has already been configured. */ teardownInstance?: (instance: I) => void | Promise; } /** * Wraps a {@link TestContextFactory} to produce a fixture that manages its own instance lifecycle. * * Built on top of {@link wrapTestContextFactory}, this variant automatically creates, sets, and tears down * an instance on the wrapped fixture for each test, using the provided {@link InstanceWrapTestContextConfig}. * * @param config - configuration for wrapping the fixture and managing instance lifecycle * @returns a function that transforms a {@link TestContextFactory} of type `F` into one of type `W` */ export declare function instanceWrapTestContextFactory, F>(config: InstanceWrapTestContextConfig): (factory: TestContextFactory) => TestContextFactory;