executable-stories-formatters 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1655,6 +1655,20 @@ interface ScenarioIndex {
1655
1655
  summary: StoryReport["summary"];
1656
1656
  scenarios: ScenarioIndexItem[];
1657
1657
  }
1658
+ /**
1659
+ * One scenario as this formatter emits it.
1660
+ *
1661
+ * This is an OUTPUT type: it describes what `toScenarioIndex` produces, which
1662
+ * is why `hash` and `assertionState` are required here while
1663
+ * `scenario-index-v1.json` marks both optional. The schema is deliberately the
1664
+ * laxer of the two so artifacts written before either field existed still
1665
+ * validate; every artifact written since carries them.
1666
+ *
1667
+ * The consequence, and it is intended: parsing an arbitrary v1 file and casting
1668
+ * it to this type is not sound for those two fields. Validate against the
1669
+ * schema and treat them as optional if you are reading files you did not just
1670
+ * write.
1671
+ */
1658
1672
  interface ScenarioIndexItem {
1659
1673
  id: string;
1660
1674
  title: string;
@@ -1681,6 +1695,12 @@ interface ScenarioIndexItem {
1681
1695
  message: string;
1682
1696
  stack?: string;
1683
1697
  };
1698
+ /**
1699
+ * Whether the scenario's claim was checked: `asserted`, `unasserted`, or
1700
+ * `unobserved` where the adapter cannot count. A passing scenario that is
1701
+ * `unasserted` ran and proved nothing.
1702
+ */
1703
+ assertionState: "asserted" | "unasserted" | "unobserved";
1684
1704
  }
1685
1705
  interface ScenarioIndexStep {
1686
1706
  id: string;
@@ -1691,6 +1711,11 @@ interface ScenarioIndexStep {
1691
1711
  durationMs: number;
1692
1712
  errorMessage?: string;
1693
1713
  docKinds: string[];
1714
+ /**
1715
+ * Assertions the framework observed. Absent means the adapter has no counter;
1716
+ * `0` means it counted none. Never defaulted — the difference is the point.
1717
+ */
1718
+ assertions?: number;
1694
1719
  }
1695
1720
  interface ScenarioIndexFilters {
1696
1721
  statuses?: TestStatus$1[];
@@ -1812,6 +1837,82 @@ interface WatchHandle {
1812
1837
  */
1813
1838
  declare function startWatch(options: WatchOptions, deps?: WatchDeps): WatchHandle;
1814
1839
 
1840
+ interface AggregateDeps {
1841
+ readFile: (filePath: string) => string;
1842
+ listDir: (dir: string) => string[] | undefined;
1843
+ logger: {
1844
+ warn(msg: string): void;
1845
+ };
1846
+ }
1847
+ interface AggregateResult {
1848
+ run: TestRunResult;
1849
+ /** How many per-file reports went into it. */
1850
+ files: number;
1851
+ /** Reports that could not be parsed. Named, never silently skipped. */
1852
+ unreadable: string[];
1853
+ /** Scenario ids claimed by more than one report. */
1854
+ duplicateIds: string[];
1855
+ }
1856
+ /**
1857
+ * Read every per-file report in `dir` and combine them into one run.
1858
+ *
1859
+ * Returns undefined when the directory holds no reports, so a caller can tell
1860
+ * "nothing here yet" from "here is an empty run".
1861
+ */
1862
+ declare function aggregateReports(args: {
1863
+ dir: string;
1864
+ }, deps: AggregateDeps): AggregateResult | undefined;
1865
+
1866
+ interface RunsLifecycleDeps {
1867
+ readFile: (filePath: string) => string;
1868
+ listDir: (dir: string) => string[] | undefined;
1869
+ removeFile: (filePath: string) => void;
1870
+ logger: {
1871
+ warn(msg: string): void;
1872
+ };
1873
+ }
1874
+ /** What one test file's report looks like from the outside. */
1875
+ interface AccumulatedFile {
1876
+ sourceFile: string;
1877
+ scenarios: number;
1878
+ /** When this file's newest scenario last ran, or undefined if none say. */
1879
+ lastRunAtMs?: number;
1880
+ lastRunGitSha?: string;
1881
+ }
1882
+ interface RunsStatusReport {
1883
+ /** Path of the reports directory, for the reader to go look. */
1884
+ directory: string;
1885
+ exists: boolean;
1886
+ files: AccumulatedFile[];
1887
+ totalScenarios: number;
1888
+ /** Reports that could not be parsed. Named, never silently skipped. */
1889
+ unreadable: string[];
1890
+ /** Human-readable rendering, what the CLI prints. */
1891
+ text: string;
1892
+ }
1893
+ /**
1894
+ * What the report would be built from right now: every test file the state
1895
+ * holds, how many scenarios each contributes, and how old those results are.
1896
+ */
1897
+ declare function runsStatus(args: {
1898
+ outputDir: string;
1899
+ nowMs: number;
1900
+ }, deps: RunsLifecycleDeps): RunsStatusReport;
1901
+ interface RunsResetResult {
1902
+ directory: string;
1903
+ removed: number;
1904
+ text: string;
1905
+ }
1906
+ /**
1907
+ * Delete every per-file report. The next full test run writes them again.
1908
+ *
1909
+ * Removes only this directory's reports; anything rendered beside it in the
1910
+ * output folder is the user's own output and is left alone.
1911
+ */
1912
+ declare function runsReset(args: {
1913
+ outputDir: string;
1914
+ }, deps: RunsLifecycleDeps): RunsResetResult;
1915
+
1815
1916
  interface BehaviorDiffEntry {
1816
1917
  id: string;
1817
1918
  title: string;
@@ -2888,6 +2989,23 @@ interface GenerateDeps {
2888
2989
  logger: Logger;
2889
2990
  /** File writer function */
2890
2991
  writeFile: WriteFile;
2992
+ /** Read a file. Throws when it is not there, like `fs.readFileSync`. */
2993
+ readFile: (filePath: string) => string;
2994
+ /** List a directory's entries, or undefined when it is not one. */
2995
+ listDir: (dir: string) => string[] | undefined;
2996
+ /** True when the path is present in the working tree. */
2997
+ fileExists: (filePath: string) => boolean;
2998
+ /** Delete a file. Absent paths are not an error. */
2999
+ removeFile: (filePath: string) => Promise<void>;
3000
+ }
3001
+ /** Options for one `generate` call. */
3002
+ interface GenerateOptions {
3003
+ /**
3004
+ * Whether this run owns the reports of the files it covers and should update
3005
+ * them. True for a test run. False when rendering an already-assembled run,
3006
+ * such as the aggregate of a shard directory, which owns nothing.
3007
+ */
3008
+ persist?: boolean;
2891
3009
  }
2892
3010
  /** Result of generate function: Map of format to array of file paths */
2893
3011
  type GenerateResult = Map<OutputFormat, string[]>;
@@ -2913,7 +3031,24 @@ declare function normalizeFormats(formats: ReadonlyArray<FormatInput>): OutputFo
2913
3031
  declare class ReportGenerator {
2914
3032
  private options;
2915
3033
  private deps;
3034
+ /**
3035
+ * The run the last `generate()` actually rendered: this run folded into what
3036
+ * previous runs accumulated. Callers that report on the output (the CLI's
3037
+ * summary line) need to describe what was written, not just what was handed
3038
+ * in. Undefined before the first generate.
3039
+ */
3040
+ private lastRenderedRun?;
3041
+ /**
3042
+ * What the execution formats rendered: this run after the same selection the
3043
+ * documentation set gets. The CLI counts whichever set its output actually
3044
+ * contains, so an excluded scenario is not reported as written.
3045
+ */
3046
+ private lastExecutedRun?;
2916
3047
  constructor(options?: FormatterOptions, deps?: Partial<GenerateDeps>);
3048
+ /** The run the last `generate()` rendered, stored reports included. */
3049
+ get renderedRun(): TestRunResult | undefined;
3050
+ /** What the last `generate()` handed the execution formats. */
3051
+ get executedRun(): TestRunResult | undefined;
2917
3052
  /**
2918
3053
  * Resolve options with defaults.
2919
3054
  */
@@ -2924,7 +3059,7 @@ declare class ReportGenerator {
2924
3059
  * @param run - Canonical TestRunResult (use canonicalizeRun to create from RawRun)
2925
3060
  * @returns Map of output format to generated file paths
2926
3061
  */
2927
- generate(run: TestRunResult): Promise<GenerateResult>;
3062
+ generate(run: TestRunResult, options?: GenerateOptions): Promise<GenerateResult>;
2928
3063
  /**
2929
3064
  * Whether any output is colocated — the global mode, or any per-rule mode.
2930
3065
  * A colocated rule under a global aggregated mode still writes per-file
@@ -3387,4 +3522,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
3387
3522
  */
3388
3523
  declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
3389
3524
 
3390
- export { type AdapterDeps, AgentTextFormatter, type AnchorResolution, type AnchorState, type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, type AttachPolicy, type BehaviorDebuggerIssue, type BehaviorDiff, type BehaviorDiffEntry, type BehaviorManifest, BehaviorManifestJsonFormatter, type BehaviorManifestJsonOptions, type BehaviorSourceFile, type BehaviorTag, type BundleOptions, type BundleResult, type CaseBody, type CaseResult, type ChangeType, type ChangedFile, type ChangedFileReview, type CheckArgs, type CheckDeps, type CheckFailure, type CheckReport, type CheckStep, type CodeDiffAnnotation, type CodeDiffAnnotationInput, type CodeDiffEvidence, type CodeDiffInput, type CodeDiffScenarioRef, type CodeDiffSidecar, type CodeDiffSidecarAnnotation, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, type CoverageClass, type CoverageJson, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DEFAULT_LOCKFILE_PATH, type DeploymentEntry, type DeploymentLedger, type DeploymentStatus, type DiffAnchor, type DiffHunk, type DiffLine, type DiffRunsOptions, type EnvironmentDrift, type EvidenceStrength, type ExecutableStoriesConfig, type FetchFn, type FileChangeKind, type FileDiff, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type GoalArgs, type GoalDeps, type GoalReport, type GoalRequirementResult, type HistoryEntry, type HistoryStore, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type JiraAuth, type JiraPublishMode, type ListScenariosArgs, type ListScenariosDeps, type LockEntry, type Lockfile, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, type NotificationSummary, type NotifyCondition, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, PROVIDER_NAMES, type PerformanceTrend, type ProviderName, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, type RatchetViolation, type RecordDeploymentArgs, type RecordDeploymentResult, type RecordResultsSummary, type ReleaseManifest, ReleaseManifestFormatter, type RemoteCase, ReportGenerator, type ResolvedFormatterOptions, type ResultAttachment, type ReviewAudience, type ReviewBand, type ReviewClaim, type ReviewContext, ReviewHtmlFormatter, type ReviewHtmlOptions, ReviewMarkdownFormatter, type ReviewMarkdownOptions, type ReviewResult, type ReviewSummary, RunDiffChangelogFormatter, type RunDiffChangelogOptions, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioIndex, type ScenarioIndexFilters, type ScenarioIndexItem, ScenarioIndexJsonFormatter, type ScenarioIndexJsonOptions, type ScenarioIndexStep, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, StoryReportJsonFormatter, type StoryReportJsonOptions, type SyncAnalysis, type SyncApplyResult, type SyncEngineConfig, type SyncProvider, type SyncTargets, type TestHistory, type TestMetrics, type TestRailConfig, TraceabilityCsvFormatter, type TraceabilityMatrix, TraceabilityMatrixFormatter, type TraceabilityRequirement, type TriageArgs, type TriageDeps, type TriageItem, type TriageReport, type WatchDeps, type WatchHandle, type WatchOptions, type WebhookPayload, type WebhookSignerHmac, type WriteFile, type XrayConfig, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, analyzeSync, applySync, assembleCodeDiff, buildCheck, buildCoverageJson, buildGoal, buildProvider, buildReview, buildTriage, bundleAssets, calculateFlakiness, calculateStability, classifyStatusChange, clearVersionCache, codeDiffDiagnostics, collectAttachments, computeTestMetrics, copyMarkdownAssets, createAnchor, createPrCommentSummary, createReportGenerator, createTestRailProvider, createXrayProvider, deriveAudience, deriveChangeType, detectCI, detectPerformanceTrend, diffRuns, diffStoryReports, emptyLockfile, findGitDir, generateRunComparison, getDeploymentStatus, getEnvironmentDrift, gradeEvidence, hasSufficientHistory, hashCaseBody, isProviderName, isReviewableSource, isTestFile, joinNameAndExt, listScenarios, loadHistory, normalizeFormats, normalizeJestResults, normalizePlaywrightResults, normalizeVitestResults, parseLockfile, parseUnifiedDiff, projectBehaviours, publishConfluencePage, publishJiraIssue, readBranchName, readGitSha, readLockfile, readPackageVersion, recordDeployment, regenerateArtifacts, regenerateRun, relocateAnchor, renderApplyResult, renderCheck, renderCoverageMarkdown, renderCoverageText, renderGoal, renderPlan, renderTriage, rewriteAssetPaths, saveHistory, scenariosCoveringPaths, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, serializeLockfile, signBody, startWatch, stripAnsi, toAgentText, toBehaviorManifest, toCaseBody, toReleaseManifest, toScenarioIndex, toTraceabilityMatrix, updateHistory, writeLockfile };
3525
+ export { type AdapterDeps, AgentTextFormatter, type AggregateDeps, type AggregateResult, type AnchorResolution, type AnchorState, type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, type AttachPolicy, type BehaviorDebuggerIssue, type BehaviorDiff, type BehaviorDiffEntry, type BehaviorManifest, BehaviorManifestJsonFormatter, type BehaviorManifestJsonOptions, type BehaviorSourceFile, type BehaviorTag, type BundleOptions, type BundleResult, type CaseBody, type CaseResult, type ChangeType, type ChangedFile, type ChangedFileReview, type CheckArgs, type CheckDeps, type CheckFailure, type CheckReport, type CheckStep, type CodeDiffAnnotation, type CodeDiffAnnotationInput, type CodeDiffEvidence, type CodeDiffInput, type CodeDiffScenarioRef, type CodeDiffSidecar, type CodeDiffSidecarAnnotation, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, type CoverageClass, type CoverageJson, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DEFAULT_LOCKFILE_PATH, type DeploymentEntry, type DeploymentLedger, type DeploymentStatus, type DiffAnchor, type DiffHunk, type DiffLine, type DiffRunsOptions, type EnvironmentDrift, type EvidenceStrength, type ExecutableStoriesConfig, type FetchFn, type FileChangeKind, type FileDiff, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type GoalArgs, type GoalDeps, type GoalReport, type GoalRequirementResult, type HistoryEntry, type HistoryStore, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type JiraAuth, type JiraPublishMode, type ListScenariosArgs, type ListScenariosDeps, type LockEntry, type Lockfile, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, type NotificationSummary, type NotifyCondition, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, PROVIDER_NAMES, type PerformanceTrend, type ProviderName, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, type RatchetViolation, type RecordDeploymentArgs, type RecordDeploymentResult, type RecordResultsSummary, type ReleaseManifest, ReleaseManifestFormatter, type RemoteCase, ReportGenerator, type ResolvedFormatterOptions, type ResultAttachment, type ReviewAudience, type ReviewBand, type ReviewClaim, type ReviewContext, ReviewHtmlFormatter, type ReviewHtmlOptions, ReviewMarkdownFormatter, type ReviewMarkdownOptions, type ReviewResult, type ReviewSummary, RunDiffChangelogFormatter, type RunDiffChangelogOptions, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type RunsResetResult, type RunsStatusReport, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioIndex, type ScenarioIndexFilters, type ScenarioIndexItem, ScenarioIndexJsonFormatter, type ScenarioIndexJsonOptions, type ScenarioIndexStep, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, StoryReportJsonFormatter, type StoryReportJsonOptions, type SyncAnalysis, type SyncApplyResult, type SyncEngineConfig, type SyncProvider, type SyncTargets, type TestHistory, type TestMetrics, type TestRailConfig, TraceabilityCsvFormatter, type TraceabilityMatrix, TraceabilityMatrixFormatter, type TraceabilityRequirement, type TriageArgs, type TriageDeps, type TriageItem, type TriageReport, type WatchDeps, type WatchHandle, type WatchOptions, type WebhookPayload, type WebhookSignerHmac, type WriteFile, type XrayConfig, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, aggregateReports, analyzeSync, applySync, assembleCodeDiff, buildCheck, buildCoverageJson, buildGoal, buildProvider, buildReview, buildTriage, bundleAssets, calculateFlakiness, calculateStability, classifyStatusChange, clearVersionCache, codeDiffDiagnostics, collectAttachments, computeTestMetrics, copyMarkdownAssets, createAnchor, createPrCommentSummary, createReportGenerator, createTestRailProvider, createXrayProvider, deriveAudience, deriveChangeType, detectCI, detectPerformanceTrend, diffRuns, diffStoryReports, emptyLockfile, findGitDir, generateRunComparison, getDeploymentStatus, getEnvironmentDrift, gradeEvidence, hasSufficientHistory, hashCaseBody, isProviderName, isReviewableSource, isTestFile, joinNameAndExt, listScenarios, loadHistory, normalizeFormats, normalizeJestResults, normalizePlaywrightResults, normalizeVitestResults, parseLockfile, parseUnifiedDiff, projectBehaviours, publishConfluencePage, publishJiraIssue, readBranchName, readGitSha, readLockfile, readPackageVersion, recordDeployment, regenerateArtifacts, regenerateRun, relocateAnchor, renderApplyResult, renderCheck, renderCoverageMarkdown, renderCoverageText, renderGoal, renderPlan, renderTriage, rewriteAssetPaths, runsReset, runsStatus, saveHistory, scenariosCoveringPaths, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, serializeLockfile, signBody, startWatch, stripAnsi, toAgentText, toBehaviorManifest, toCaseBody, toReleaseManifest, toScenarioIndex, toTraceabilityMatrix, updateHistory, writeLockfile };
package/dist/index.d.ts CHANGED
@@ -1655,6 +1655,20 @@ interface ScenarioIndex {
1655
1655
  summary: StoryReport["summary"];
1656
1656
  scenarios: ScenarioIndexItem[];
1657
1657
  }
1658
+ /**
1659
+ * One scenario as this formatter emits it.
1660
+ *
1661
+ * This is an OUTPUT type: it describes what `toScenarioIndex` produces, which
1662
+ * is why `hash` and `assertionState` are required here while
1663
+ * `scenario-index-v1.json` marks both optional. The schema is deliberately the
1664
+ * laxer of the two so artifacts written before either field existed still
1665
+ * validate; every artifact written since carries them.
1666
+ *
1667
+ * The consequence, and it is intended: parsing an arbitrary v1 file and casting
1668
+ * it to this type is not sound for those two fields. Validate against the
1669
+ * schema and treat them as optional if you are reading files you did not just
1670
+ * write.
1671
+ */
1658
1672
  interface ScenarioIndexItem {
1659
1673
  id: string;
1660
1674
  title: string;
@@ -1681,6 +1695,12 @@ interface ScenarioIndexItem {
1681
1695
  message: string;
1682
1696
  stack?: string;
1683
1697
  };
1698
+ /**
1699
+ * Whether the scenario's claim was checked: `asserted`, `unasserted`, or
1700
+ * `unobserved` where the adapter cannot count. A passing scenario that is
1701
+ * `unasserted` ran and proved nothing.
1702
+ */
1703
+ assertionState: "asserted" | "unasserted" | "unobserved";
1684
1704
  }
1685
1705
  interface ScenarioIndexStep {
1686
1706
  id: string;
@@ -1691,6 +1711,11 @@ interface ScenarioIndexStep {
1691
1711
  durationMs: number;
1692
1712
  errorMessage?: string;
1693
1713
  docKinds: string[];
1714
+ /**
1715
+ * Assertions the framework observed. Absent means the adapter has no counter;
1716
+ * `0` means it counted none. Never defaulted — the difference is the point.
1717
+ */
1718
+ assertions?: number;
1694
1719
  }
1695
1720
  interface ScenarioIndexFilters {
1696
1721
  statuses?: TestStatus$1[];
@@ -1812,6 +1837,82 @@ interface WatchHandle {
1812
1837
  */
1813
1838
  declare function startWatch(options: WatchOptions, deps?: WatchDeps): WatchHandle;
1814
1839
 
1840
+ interface AggregateDeps {
1841
+ readFile: (filePath: string) => string;
1842
+ listDir: (dir: string) => string[] | undefined;
1843
+ logger: {
1844
+ warn(msg: string): void;
1845
+ };
1846
+ }
1847
+ interface AggregateResult {
1848
+ run: TestRunResult;
1849
+ /** How many per-file reports went into it. */
1850
+ files: number;
1851
+ /** Reports that could not be parsed. Named, never silently skipped. */
1852
+ unreadable: string[];
1853
+ /** Scenario ids claimed by more than one report. */
1854
+ duplicateIds: string[];
1855
+ }
1856
+ /**
1857
+ * Read every per-file report in `dir` and combine them into one run.
1858
+ *
1859
+ * Returns undefined when the directory holds no reports, so a caller can tell
1860
+ * "nothing here yet" from "here is an empty run".
1861
+ */
1862
+ declare function aggregateReports(args: {
1863
+ dir: string;
1864
+ }, deps: AggregateDeps): AggregateResult | undefined;
1865
+
1866
+ interface RunsLifecycleDeps {
1867
+ readFile: (filePath: string) => string;
1868
+ listDir: (dir: string) => string[] | undefined;
1869
+ removeFile: (filePath: string) => void;
1870
+ logger: {
1871
+ warn(msg: string): void;
1872
+ };
1873
+ }
1874
+ /** What one test file's report looks like from the outside. */
1875
+ interface AccumulatedFile {
1876
+ sourceFile: string;
1877
+ scenarios: number;
1878
+ /** When this file's newest scenario last ran, or undefined if none say. */
1879
+ lastRunAtMs?: number;
1880
+ lastRunGitSha?: string;
1881
+ }
1882
+ interface RunsStatusReport {
1883
+ /** Path of the reports directory, for the reader to go look. */
1884
+ directory: string;
1885
+ exists: boolean;
1886
+ files: AccumulatedFile[];
1887
+ totalScenarios: number;
1888
+ /** Reports that could not be parsed. Named, never silently skipped. */
1889
+ unreadable: string[];
1890
+ /** Human-readable rendering, what the CLI prints. */
1891
+ text: string;
1892
+ }
1893
+ /**
1894
+ * What the report would be built from right now: every test file the state
1895
+ * holds, how many scenarios each contributes, and how old those results are.
1896
+ */
1897
+ declare function runsStatus(args: {
1898
+ outputDir: string;
1899
+ nowMs: number;
1900
+ }, deps: RunsLifecycleDeps): RunsStatusReport;
1901
+ interface RunsResetResult {
1902
+ directory: string;
1903
+ removed: number;
1904
+ text: string;
1905
+ }
1906
+ /**
1907
+ * Delete every per-file report. The next full test run writes them again.
1908
+ *
1909
+ * Removes only this directory's reports; anything rendered beside it in the
1910
+ * output folder is the user's own output and is left alone.
1911
+ */
1912
+ declare function runsReset(args: {
1913
+ outputDir: string;
1914
+ }, deps: RunsLifecycleDeps): RunsResetResult;
1915
+
1815
1916
  interface BehaviorDiffEntry {
1816
1917
  id: string;
1817
1918
  title: string;
@@ -2888,6 +2989,23 @@ interface GenerateDeps {
2888
2989
  logger: Logger;
2889
2990
  /** File writer function */
2890
2991
  writeFile: WriteFile;
2992
+ /** Read a file. Throws when it is not there, like `fs.readFileSync`. */
2993
+ readFile: (filePath: string) => string;
2994
+ /** List a directory's entries, or undefined when it is not one. */
2995
+ listDir: (dir: string) => string[] | undefined;
2996
+ /** True when the path is present in the working tree. */
2997
+ fileExists: (filePath: string) => boolean;
2998
+ /** Delete a file. Absent paths are not an error. */
2999
+ removeFile: (filePath: string) => Promise<void>;
3000
+ }
3001
+ /** Options for one `generate` call. */
3002
+ interface GenerateOptions {
3003
+ /**
3004
+ * Whether this run owns the reports of the files it covers and should update
3005
+ * them. True for a test run. False when rendering an already-assembled run,
3006
+ * such as the aggregate of a shard directory, which owns nothing.
3007
+ */
3008
+ persist?: boolean;
2891
3009
  }
2892
3010
  /** Result of generate function: Map of format to array of file paths */
2893
3011
  type GenerateResult = Map<OutputFormat, string[]>;
@@ -2913,7 +3031,24 @@ declare function normalizeFormats(formats: ReadonlyArray<FormatInput>): OutputFo
2913
3031
  declare class ReportGenerator {
2914
3032
  private options;
2915
3033
  private deps;
3034
+ /**
3035
+ * The run the last `generate()` actually rendered: this run folded into what
3036
+ * previous runs accumulated. Callers that report on the output (the CLI's
3037
+ * summary line) need to describe what was written, not just what was handed
3038
+ * in. Undefined before the first generate.
3039
+ */
3040
+ private lastRenderedRun?;
3041
+ /**
3042
+ * What the execution formats rendered: this run after the same selection the
3043
+ * documentation set gets. The CLI counts whichever set its output actually
3044
+ * contains, so an excluded scenario is not reported as written.
3045
+ */
3046
+ private lastExecutedRun?;
2916
3047
  constructor(options?: FormatterOptions, deps?: Partial<GenerateDeps>);
3048
+ /** The run the last `generate()` rendered, stored reports included. */
3049
+ get renderedRun(): TestRunResult | undefined;
3050
+ /** What the last `generate()` handed the execution formats. */
3051
+ get executedRun(): TestRunResult | undefined;
2917
3052
  /**
2918
3053
  * Resolve options with defaults.
2919
3054
  */
@@ -2924,7 +3059,7 @@ declare class ReportGenerator {
2924
3059
  * @param run - Canonical TestRunResult (use canonicalizeRun to create from RawRun)
2925
3060
  * @returns Map of output format to generated file paths
2926
3061
  */
2927
- generate(run: TestRunResult): Promise<GenerateResult>;
3062
+ generate(run: TestRunResult, options?: GenerateOptions): Promise<GenerateResult>;
2928
3063
  /**
2929
3064
  * Whether any output is colocated — the global mode, or any per-rule mode.
2930
3065
  * A colocated rule under a global aggregated mode still writes per-file
@@ -3387,4 +3522,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
3387
3522
  */
3388
3523
  declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
3389
3524
 
3390
- export { type AdapterDeps, AgentTextFormatter, type AnchorResolution, type AnchorState, type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, type AttachPolicy, type BehaviorDebuggerIssue, type BehaviorDiff, type BehaviorDiffEntry, type BehaviorManifest, BehaviorManifestJsonFormatter, type BehaviorManifestJsonOptions, type BehaviorSourceFile, type BehaviorTag, type BundleOptions, type BundleResult, type CaseBody, type CaseResult, type ChangeType, type ChangedFile, type ChangedFileReview, type CheckArgs, type CheckDeps, type CheckFailure, type CheckReport, type CheckStep, type CodeDiffAnnotation, type CodeDiffAnnotationInput, type CodeDiffEvidence, type CodeDiffInput, type CodeDiffScenarioRef, type CodeDiffSidecar, type CodeDiffSidecarAnnotation, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, type CoverageClass, type CoverageJson, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DEFAULT_LOCKFILE_PATH, type DeploymentEntry, type DeploymentLedger, type DeploymentStatus, type DiffAnchor, type DiffHunk, type DiffLine, type DiffRunsOptions, type EnvironmentDrift, type EvidenceStrength, type ExecutableStoriesConfig, type FetchFn, type FileChangeKind, type FileDiff, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type GoalArgs, type GoalDeps, type GoalReport, type GoalRequirementResult, type HistoryEntry, type HistoryStore, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type JiraAuth, type JiraPublishMode, type ListScenariosArgs, type ListScenariosDeps, type LockEntry, type Lockfile, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, type NotificationSummary, type NotifyCondition, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, PROVIDER_NAMES, type PerformanceTrend, type ProviderName, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, type RatchetViolation, type RecordDeploymentArgs, type RecordDeploymentResult, type RecordResultsSummary, type ReleaseManifest, ReleaseManifestFormatter, type RemoteCase, ReportGenerator, type ResolvedFormatterOptions, type ResultAttachment, type ReviewAudience, type ReviewBand, type ReviewClaim, type ReviewContext, ReviewHtmlFormatter, type ReviewHtmlOptions, ReviewMarkdownFormatter, type ReviewMarkdownOptions, type ReviewResult, type ReviewSummary, RunDiffChangelogFormatter, type RunDiffChangelogOptions, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioIndex, type ScenarioIndexFilters, type ScenarioIndexItem, ScenarioIndexJsonFormatter, type ScenarioIndexJsonOptions, type ScenarioIndexStep, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, StoryReportJsonFormatter, type StoryReportJsonOptions, type SyncAnalysis, type SyncApplyResult, type SyncEngineConfig, type SyncProvider, type SyncTargets, type TestHistory, type TestMetrics, type TestRailConfig, TraceabilityCsvFormatter, type TraceabilityMatrix, TraceabilityMatrixFormatter, type TraceabilityRequirement, type TriageArgs, type TriageDeps, type TriageItem, type TriageReport, type WatchDeps, type WatchHandle, type WatchOptions, type WebhookPayload, type WebhookSignerHmac, type WriteFile, type XrayConfig, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, analyzeSync, applySync, assembleCodeDiff, buildCheck, buildCoverageJson, buildGoal, buildProvider, buildReview, buildTriage, bundleAssets, calculateFlakiness, calculateStability, classifyStatusChange, clearVersionCache, codeDiffDiagnostics, collectAttachments, computeTestMetrics, copyMarkdownAssets, createAnchor, createPrCommentSummary, createReportGenerator, createTestRailProvider, createXrayProvider, deriveAudience, deriveChangeType, detectCI, detectPerformanceTrend, diffRuns, diffStoryReports, emptyLockfile, findGitDir, generateRunComparison, getDeploymentStatus, getEnvironmentDrift, gradeEvidence, hasSufficientHistory, hashCaseBody, isProviderName, isReviewableSource, isTestFile, joinNameAndExt, listScenarios, loadHistory, normalizeFormats, normalizeJestResults, normalizePlaywrightResults, normalizeVitestResults, parseLockfile, parseUnifiedDiff, projectBehaviours, publishConfluencePage, publishJiraIssue, readBranchName, readGitSha, readLockfile, readPackageVersion, recordDeployment, regenerateArtifacts, regenerateRun, relocateAnchor, renderApplyResult, renderCheck, renderCoverageMarkdown, renderCoverageText, renderGoal, renderPlan, renderTriage, rewriteAssetPaths, saveHistory, scenariosCoveringPaths, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, serializeLockfile, signBody, startWatch, stripAnsi, toAgentText, toBehaviorManifest, toCaseBody, toReleaseManifest, toScenarioIndex, toTraceabilityMatrix, updateHistory, writeLockfile };
3525
+ export { type AdapterDeps, AgentTextFormatter, type AggregateDeps, type AggregateResult, type AnchorResolution, type AnchorState, type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, type AttachPolicy, type BehaviorDebuggerIssue, type BehaviorDiff, type BehaviorDiffEntry, type BehaviorManifest, BehaviorManifestJsonFormatter, type BehaviorManifestJsonOptions, type BehaviorSourceFile, type BehaviorTag, type BundleOptions, type BundleResult, type CaseBody, type CaseResult, type ChangeType, type ChangedFile, type ChangedFileReview, type CheckArgs, type CheckDeps, type CheckFailure, type CheckReport, type CheckStep, type CodeDiffAnnotation, type CodeDiffAnnotationInput, type CodeDiffEvidence, type CodeDiffInput, type CodeDiffScenarioRef, type CodeDiffSidecar, type CodeDiffSidecarAnnotation, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, type CoverageClass, type CoverageJson, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DEFAULT_LOCKFILE_PATH, type DeploymentEntry, type DeploymentLedger, type DeploymentStatus, type DiffAnchor, type DiffHunk, type DiffLine, type DiffRunsOptions, type EnvironmentDrift, type EvidenceStrength, type ExecutableStoriesConfig, type FetchFn, type FileChangeKind, type FileDiff, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type GoalArgs, type GoalDeps, type GoalReport, type GoalRequirementResult, type HistoryEntry, type HistoryStore, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type JiraAuth, type JiraPublishMode, type ListScenariosArgs, type ListScenariosDeps, type LockEntry, type Lockfile, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, type NotificationSummary, type NotifyCondition, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, PROVIDER_NAMES, type PerformanceTrend, type ProviderName, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, type RatchetViolation, type RecordDeploymentArgs, type RecordDeploymentResult, type RecordResultsSummary, type ReleaseManifest, ReleaseManifestFormatter, type RemoteCase, ReportGenerator, type ResolvedFormatterOptions, type ResultAttachment, type ReviewAudience, type ReviewBand, type ReviewClaim, type ReviewContext, ReviewHtmlFormatter, type ReviewHtmlOptions, ReviewMarkdownFormatter, type ReviewMarkdownOptions, type ReviewResult, type ReviewSummary, RunDiffChangelogFormatter, type RunDiffChangelogOptions, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type RunsResetResult, type RunsStatusReport, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioIndex, type ScenarioIndexFilters, type ScenarioIndexItem, ScenarioIndexJsonFormatter, type ScenarioIndexJsonOptions, type ScenarioIndexStep, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, StoryReportJsonFormatter, type StoryReportJsonOptions, type SyncAnalysis, type SyncApplyResult, type SyncEngineConfig, type SyncProvider, type SyncTargets, type TestHistory, type TestMetrics, type TestRailConfig, TraceabilityCsvFormatter, type TraceabilityMatrix, TraceabilityMatrixFormatter, type TraceabilityRequirement, type TriageArgs, type TriageDeps, type TriageItem, type TriageReport, type WatchDeps, type WatchHandle, type WatchOptions, type WebhookPayload, type WebhookSignerHmac, type WriteFile, type XrayConfig, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, aggregateReports, analyzeSync, applySync, assembleCodeDiff, buildCheck, buildCoverageJson, buildGoal, buildProvider, buildReview, buildTriage, bundleAssets, calculateFlakiness, calculateStability, classifyStatusChange, clearVersionCache, codeDiffDiagnostics, collectAttachments, computeTestMetrics, copyMarkdownAssets, createAnchor, createPrCommentSummary, createReportGenerator, createTestRailProvider, createXrayProvider, deriveAudience, deriveChangeType, detectCI, detectPerformanceTrend, diffRuns, diffStoryReports, emptyLockfile, findGitDir, generateRunComparison, getDeploymentStatus, getEnvironmentDrift, gradeEvidence, hasSufficientHistory, hashCaseBody, isProviderName, isReviewableSource, isTestFile, joinNameAndExt, listScenarios, loadHistory, normalizeFormats, normalizeJestResults, normalizePlaywrightResults, normalizeVitestResults, parseLockfile, parseUnifiedDiff, projectBehaviours, publishConfluencePage, publishJiraIssue, readBranchName, readGitSha, readLockfile, readPackageVersion, recordDeployment, regenerateArtifacts, regenerateRun, relocateAnchor, renderApplyResult, renderCheck, renderCoverageMarkdown, renderCoverageText, renderGoal, renderPlan, renderTriage, rewriteAssetPaths, runsReset, runsStatus, saveHistory, scenariosCoveringPaths, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, serializeLockfile, signBody, startWatch, stripAnsi, toAgentText, toBehaviorManifest, toCaseBody, toReleaseManifest, toScenarioIndex, toTraceabilityMatrix, updateHistory, writeLockfile };