UNPKG

histoire

Version:

A fast story book powered by Vite

54 lines • 2.29 kB
import type { TestModule, Vitest } from 'vitest/node'; import type { Context } from '../context.js'; import type { CollectionSpecFile, StoryCollectionFailure } from './types.js'; /** * What the collection channel received for one run. */ interface CollectionPayload { results: Map<string, { file: string; }>; failures: Map<string, { error: string; }>; } /** * Everything that went wrong during a browser collection run, split by whether * it can be blamed on a single story. */ export interface CollectionRunDiagnostics { /** * Errors that cannot be attributed to one story: unhandled browser errors, or * a module error in the shared collector module. They break every story of * the run, so they always abort it. */ fatalErrors: string[]; /** Errors attributed to a single story file each. */ storyFailures: StoryCollectionFailure[]; } /** * Inspects a finished browser collection run and reports what failed. * * Attribution matters: `histoire test` collects every story only to discover * which ones register tests, so a single broken story must be reportable on its * own instead of aborting the whole run. Only errors that cannot be traced back * to one story stay fatal. * @param storyFiles The story files the run was supposed to collect. * @param vitest The Vitest instance that ran the collection. * @param testModules The test modules Vitest executed. * @param collectionPayload What the collection channel received for this run. * @param specFiles The generated specs, used to map a module back to its story. */ export declare function analyzeCollectionRun(storyFiles: Context['storyFiles'], vitest: Vitest, testModules: TestModule[], collectionPayload: CollectionPayload, specFiles: CollectionSpecFile[]): CollectionRunDiagnostics; /** * Formats one story failure as a printable block. * @param failure The failure to format. */ export declare function formatStoryCollectionFailure(failure: StoryCollectionFailure): string; /** * Builds the error thrown when a browser collection run cannot be recovered. * @param errors The formatted error blocks to report. */ export declare function createCollectionFailedError(errors: string[]): Error; export {}; //# sourceMappingURL=assert.d.ts.map