/** * Public testing primitives for weft consumers. * * Imported via `@lostgradient/weft/testing` to keep production bundles free of * test-only code. Re-exports {@link TestEngine}, {@link TimeControl}, * {@link ActivityMockRegistry}, and the chaos helpers. * * @module @lostgradient/weft/testing */ import { ChaosNonRetryableError, ChaosTimeoutError, ChaosTransientError, withChaos } from './chaos'; import { flushPortableMicrotasks, yieldToPortableEventLoop } from './event-loop'; import { ActivityMockRegistry } from './mocks'; import { killAndReboot, spawnServerSubprocess, withSubprocessServer } from './subprocess-engine'; import { TestEngine } from './test-engine'; import { TimeControl } from './time-control'; /** * Re-exported {@link ActivityMockRegistry}. See the original declaration for full docs. * * @example * ```ts * import { ActivityMockRegistry } from '@lostgradient/weft/testing'; * const registry = new ActivityMockRegistry(); * void registry; * ``` */ declare const exportedActivityMockRegistry: typeof ActivityMockRegistry; /** * Re-exported {@link ChaosNonRetryableError}. See the original declaration for full docs. * * @example * ```ts * import { ChaosNonRetryableError } from '@lostgradient/weft/testing'; * const error = new ChaosNonRetryableError('chaos'); * void error; * ``` */ declare const exportedChaosNonRetryableError: typeof ChaosNonRetryableError; /** * Re-exported {@link ChaosTimeoutError}. See the original declaration for full docs. * * @example * ```ts * import { ChaosTimeoutError } from '@lostgradient/weft/testing'; * const error = new ChaosTimeoutError(1000); * void error; * ``` */ declare const exportedChaosTimeoutError: typeof ChaosTimeoutError; /** * Re-exported {@link ChaosTransientError}. See the original declaration for full docs. * * @example * ```ts * import { ChaosTransientError } from '@lostgradient/weft/testing'; * const error = new ChaosTransientError('transient'); * void error; * ``` */ declare const exportedChaosTransientError: typeof ChaosTransientError; /** * Re-exported {@link TestEngine}. See the original declaration for full docs. * * @example * ```ts * import { TestEngine } from '@lostgradient/weft/testing'; * await using engine = new TestEngine(); * void engine; * ``` */ declare const exportedTestEngine: typeof TestEngine; /** * Re-exported {@link TimeControl}. See the original declaration for full docs. * * @example * ```ts * import { TimeControl } from '@lostgradient/weft/testing'; * const control = new TimeControl(); * void control; * ``` */ declare const exportedTimeControl: typeof TimeControl; /** * Re-exported {@link withChaos}. See the original declaration for full docs. * * @example * ```ts * import { withChaos } from '@lostgradient/weft/testing'; * const wrapped = withChaos(async () => 'ok', { faultRate: 0.1 }); * void wrapped; * ``` */ declare const exportedWithChaos: typeof withChaos; /** * Re-exported {@link spawnServerSubprocess}. See the original declaration for full docs. * * @example * ```ts * import { spawnServerSubprocess } from '@lostgradient/weft/testing'; * void spawnServerSubprocess; * ``` */ declare const exportedSpawnServerSubprocess: typeof spawnServerSubprocess; /** * Re-exported {@link killAndReboot}. See the original declaration for full docs. * * @example * ```ts * import { killAndReboot } from '@lostgradient/weft/testing'; * void killAndReboot; * ``` */ declare const exportedKillAndReboot: typeof killAndReboot; /** * Re-exported {@link withSubprocessServer}. See the original declaration for full docs. * * @example * ```ts * import { withSubprocessServer } from '@lostgradient/weft/testing'; * void withSubprocessServer; * ``` */ declare const exportedWithSubprocessServer: typeof withSubprocessServer; /** * Re-exported {@link yieldToPortableEventLoop}. See the original declaration for full docs. * * Yields one event-loop turn without test-runner-only timer APIs. Use it in an * `afterEach` to drain a prior test's deferred inline workflow launch: under a * shared-process runner (Bun, Jest, Vitest), an engine disposed mid-workflow can * otherwise leave a queued inline start that starves the next test. * * @example * ```ts * import { yieldToPortableEventLoop } from '@lostgradient/weft/testing'; * afterEach(yieldToPortableEventLoop); * ``` */ declare const exportedYieldToPortableEventLoop: typeof yieldToPortableEventLoop; /** * Re-exported {@link flushPortableMicrotasks}. See the original declaration for full docs. * * Lets queued microtasks settle without advancing time or yielding a full * event-loop turn — the cheaper drain when you only need promise continuations * to run. * * @example * ```ts * import { flushPortableMicrotasks } from '@lostgradient/weft/testing'; * await flushPortableMicrotasks(); * ``` */ declare const exportedFlushPortableMicrotasks: typeof flushPortableMicrotasks; export type { ChaosScenario, FaultClass } from './chaos'; export type { MockCall, MockedActivity, MockHandle } from './mocks'; export type { SubprocessServerHandle, SubprocessServerOptions, SubprocessServerProcess, SubprocessSignal, } from './subprocess-engine'; export type { RunNOptions, RunNResult } from './test-engine'; export { exportedActivityMockRegistry as ActivityMockRegistry, exportedChaosNonRetryableError as ChaosNonRetryableError, exportedChaosTimeoutError as ChaosTimeoutError, exportedChaosTransientError as ChaosTransientError, exportedFlushPortableMicrotasks as flushPortableMicrotasks, exportedKillAndReboot as killAndReboot, exportedSpawnServerSubprocess as spawnServerSubprocess, exportedTestEngine as TestEngine, exportedTimeControl as TimeControl, exportedWithChaos as withChaos, exportedWithSubprocessServer as withSubprocessServer, exportedYieldToPortableEventLoop as yieldToPortableEventLoop, };