UNPKG

histoire

Version:

A fast story book powered by Vite

37 lines • 2.45 kB
import type { HistoireSerializedTestDefinition } from '@histoire/shared'; import type { VariantSession } from './session.js'; import type { VariantTestSessionOptions } from './types.js'; export { getMatchingDefinition } from './definitions.js'; export { releaseFinishedSpecs } from './finished-specs.js'; export type { VariantSession } from './session.js'; export { hasVanillaSetupHooks } from './setup-hooks.js'; export type { SerializedStoryFile, VariantTestSessionOptions } from './types.js'; export { getVitestBrowserMountCleanups } from './worker-state.js'; /** * Creates the browser-side session driving story test collection and execution. * * The same session object is reused for the whole lifetime of the preview * iframe (or of the Vitest test harness), so it owns the story module cache and * serializes its flows — collect and run both take over the global test * registry while they mount a variant. * * Execution is split by ownership: run.ts walks preview suites once, while * run-single-definition.ts wraps each CLI test in its own mounted suites. * Both use run-definition.ts for the per-test lifecycle, hooks.ts and * around-hooks.ts for setup/teardown, and task-callbacks.ts for final results. * @param options Baked story metadata, module loaders and mount options. */ export declare function createVariantTestSession(options: VariantTestSessionOptions): { collectVariantTests: (storyId: string, variantId: string) => Promise<HistoireSerializedTestDefinition[]>; prepareVariantTestRun: (storyId: string, variantId: string, cleanups: (() => void)[] | undefined) => Promise<{ definitions: HistoireSerializedTestDefinition[]; run: (definition: HistoireSerializedTestDefinition) => Promise<void>; }>; loadStoryFile: (storyId: string) => Promise<import("@histoire/shared").StoryFile>; getStoryModuleVersion: (storyId: string) => number; invalidateStory: (storyId: string) => void; runCollectedTest: (storyId: string, variantId: string, definition: HistoireSerializedTestDefinition, takeMount?: () => VariantSession | undefined) => Promise<void>; runPreviewTestCase: (storyId: string, variantId: string, definition: HistoireSerializedTestDefinition) => Promise<import("@histoire/protocol").HistoireTestRunSummary>; runVariantTests: (storyId: string, variantId: string) => Promise<import("@histoire/protocol").HistoireTestRunSummary>; }; //# sourceMappingURL=index.d.ts.map