executable-stories-formatters 1.11.0 → 1.12.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/adapters.cjs +17 -0
- package/dist/adapters.cjs.map +1 -1
- package/dist/adapters.d.cts +3 -1
- package/dist/adapters.d.ts +3 -1
- package/dist/adapters.js +17 -0
- package/dist/adapters.js.map +1 -1
- package/dist/cli.js +8883 -8573
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +9152 -9082
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +199 -167
- package/dist/index.d.ts +199 -167
- package/dist/index.js +8928 -8848
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/schemas/raw-run.schema.json +73 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestRunResult, TestCaseResult, TestStatus, Attachment } from 'executable-stories-core/types/test-result';
|
|
2
|
-
export { Attachment, CIInfo, CoverageSummary, StepResult, TestCaseAttempt, TestCaseEvidence, TestCaseResult, TestRunResult, TestStatus } from 'executable-stories-core/types/test-result';
|
|
2
|
+
export { Attachment, CIInfo, CoverageSummary, FeatureDeclaration, GlossaryTerm, StepResult, TestCaseAttempt, TestCaseEvidence, TestCaseResult, TestRunResult, TestStatus } from 'executable-stories-core/types/test-result';
|
|
3
3
|
import { StoryStep, DocEntry, NormalizedTicket, StepKeyword } from 'executable-stories-core/types/story';
|
|
4
4
|
export { DocEntry, DocPhase, NormalizedTicket, STORY_META_KEY, StepKeyword, StepMode, StoryMeta, StoryStep } from 'executable-stories-core/types/story';
|
|
5
5
|
import { CIInfo, CIProvider } from 'executable-stories-core/types/ci';
|
|
@@ -8,11 +8,15 @@ import { adaptJestRun, adaptPlaywrightRun, adaptVitestRun } from './adapters.cjs
|
|
|
8
8
|
export { JestAdapterOptions, JestAggregatedResult, JestFileResult, JestTestResult, PlaywrightAdapterOptions, PlaywrightAnnotation, PlaywrightAttachment, PlaywrightError, PlaywrightLocation, PlaywrightStatus, PlaywrightTestCase, PlaywrightTestResult, StoryFileReport, VitestAdapterOptions, VitestSerializedError, VitestState, VitestTestCase, VitestTestModule, VitestTestResult } from './adapters.cjs';
|
|
9
9
|
export { OtelAttributeValue, OtelSpan } from 'executable-stories-core/types/otel';
|
|
10
10
|
import { RawCIInfo } from 'executable-stories-core/types/raw';
|
|
11
|
-
export { RawAttachment, RawCIInfo, RawRun, RawStatus, RawStepEvent, RawTestCase } from 'executable-stories-core/types/raw';
|
|
11
|
+
export { RawAttachment, RawCIInfo, RawFeature, RawGlossaryTerm, RawRun, RawStatus, RawStepEvent, RawTestCase } from 'executable-stories-core/types/raw';
|
|
12
12
|
import { StoryReport, TestStatus as TestStatus$1, ReportStep } from 'executable-stories-core/types/story-report';
|
|
13
13
|
export { ReportAttachment, ReportCIInfo, ReportCoverageSummary, ReportDocCode, ReportDocCustom, ReportDocEntry, ReportDocKv, ReportDocLink, ReportDocMermaid, ReportDocNote, ReportDocScreenshot, ReportDocSection, ReportDocTable, ReportDocTag, ReportFeature, ReportScenario, ReportStep, ReportSummary, ReportTicket, STORY_REPORT_SCHEMA_MAJOR, STORY_REPORT_SCHEMA_VERSION, StoryReport, StoryReportSchemaVersion } from 'executable-stories-core/types/story-report';
|
|
14
14
|
export { ES_THEME_TOKENS_CSS, ES_THEME_TOKEN_VALUES } from 'executable-stories-core/theme/tokens';
|
|
15
|
-
export { canonicalizeRun
|
|
15
|
+
export { canonicalizeRun } from 'executable-stories-core/converters/acl/canonicalize';
|
|
16
|
+
export { normalizeStatus } from 'executable-stories-core/converters/acl/status';
|
|
17
|
+
export { generateRunId, generateTestCaseId, slugify } from 'executable-stories-core/converters/acl/ids';
|
|
18
|
+
export { deriveStepResults, mergeStepResults } from 'executable-stories-core/converters/acl/steps';
|
|
19
|
+
export { resolveAttachment, resolveAttachments } from 'executable-stories-core/converters/acl/attachments';
|
|
16
20
|
export { ValidationResult, assertValidRun, validateCanonicalRun } from 'executable-stories-core/converters/acl/validate';
|
|
17
21
|
export { RunState, advanceState, initialRunState } from 'executable-stories-core';
|
|
18
22
|
export { toStoryReport } from 'executable-stories-core/converters/story-report';
|
|
@@ -537,82 +541,6 @@ interface ResolvedFormatterOptions {
|
|
|
537
541
|
allowMissingAssets: boolean;
|
|
538
542
|
}
|
|
539
543
|
|
|
540
|
-
type ScenarioChangeKind = "added" | "removed" | "renamed" | "moved" | "regressed" | "fixed" | "changed" | "unchanged";
|
|
541
|
-
interface ScenarioChangeFlags {
|
|
542
|
-
status: boolean;
|
|
543
|
-
steps: boolean;
|
|
544
|
-
docs: boolean;
|
|
545
|
-
tags: boolean;
|
|
546
|
-
tickets: boolean;
|
|
547
|
-
source: boolean;
|
|
548
|
-
duration: boolean;
|
|
549
|
-
attachments: boolean;
|
|
550
|
-
error: boolean;
|
|
551
|
-
titlePath: boolean;
|
|
552
|
-
}
|
|
553
|
-
interface ScenarioSnapshot {
|
|
554
|
-
id: string;
|
|
555
|
-
scenario: string;
|
|
556
|
-
sourceFile: string;
|
|
557
|
-
sourceLine: number;
|
|
558
|
-
status: TestStatus;
|
|
559
|
-
durationMs: number;
|
|
560
|
-
tags: string[];
|
|
561
|
-
titlePath: string[];
|
|
562
|
-
steps: StoryStep[];
|
|
563
|
-
docs: DocEntry[];
|
|
564
|
-
tickets: NormalizedTicket[];
|
|
565
|
-
attachments: Attachment[];
|
|
566
|
-
errorMessage?: string;
|
|
567
|
-
}
|
|
568
|
-
interface ScenarioDiff {
|
|
569
|
-
kind: ScenarioChangeKind;
|
|
570
|
-
id: string;
|
|
571
|
-
scenario: string;
|
|
572
|
-
sourceFile: string;
|
|
573
|
-
sourceLine: number;
|
|
574
|
-
baseline?: ScenarioSnapshot;
|
|
575
|
-
current?: ScenarioSnapshot;
|
|
576
|
-
flags: ScenarioChangeFlags;
|
|
577
|
-
changedFields: string[];
|
|
578
|
-
durationDeltaMs?: number;
|
|
579
|
-
/** For `renamed`/`moved`: the baseline test-case id this behaviour was matched from. */
|
|
580
|
-
previousId?: string;
|
|
581
|
-
/** For `renamed`/`moved`: match confidence in 0..1 (1 = exact content fingerprint). */
|
|
582
|
-
matchConfidence?: number;
|
|
583
|
-
/** For `renamed`/`moved`: how the baseline/current pair was re-identified. */
|
|
584
|
-
matchedBy?: "fingerprint" | "similarity";
|
|
585
|
-
}
|
|
586
|
-
interface RunDiffSummary {
|
|
587
|
-
totalBaseline: number;
|
|
588
|
-
totalCurrent: number;
|
|
589
|
-
added: number;
|
|
590
|
-
removed: number;
|
|
591
|
-
/** Behaviours re-identified across a title change (content preserved). */
|
|
592
|
-
renamed: number;
|
|
593
|
-
/** Behaviours re-identified across a file move (content preserved). */
|
|
594
|
-
moved: number;
|
|
595
|
-
changed: number;
|
|
596
|
-
regressed: number;
|
|
597
|
-
fixed: number;
|
|
598
|
-
unchanged: number;
|
|
599
|
-
/**
|
|
600
|
-
* Baseline scenarios skipped because the current run is partial and never
|
|
601
|
-
* touched their source file. Always 0 for a full-run diff.
|
|
602
|
-
*/
|
|
603
|
-
notRun: number;
|
|
604
|
-
}
|
|
605
|
-
interface RunDiffResult {
|
|
606
|
-
baseline: TestRunResult;
|
|
607
|
-
current: TestRunResult;
|
|
608
|
-
summary: RunDiffSummary;
|
|
609
|
-
scenarios: ScenarioDiff[];
|
|
610
|
-
}
|
|
611
|
-
type CompareFormat = "html" | "markdown" | "changelog";
|
|
612
|
-
interface CompareFormatterOptions {
|
|
613
|
-
title?: string;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
544
|
/**
|
|
617
545
|
* Cucumber JSON format types.
|
|
618
546
|
*
|
|
@@ -727,7 +655,7 @@ interface IJsonFeature {
|
|
|
727
655
|
* between them and a vendor API.
|
|
728
656
|
*
|
|
729
657
|
* Adding a provider is one file in `adapters/` plus one line in
|
|
730
|
-
* `adapters/
|
|
658
|
+
* `adapters/registry.ts`, with no edits to `engine.ts`. If a new adapter forces an
|
|
731
659
|
* engine change, this port is wrong and gets fixed then, on evidence.
|
|
732
660
|
*
|
|
733
661
|
* Every method except `listCases` is optional. A read-only provider implements
|
|
@@ -1289,6 +1217,82 @@ declare function renderPlan(analysis: SyncAnalysis, opts: {
|
|
|
1289
1217
|
/** What actually happened, printed after a real run. */
|
|
1290
1218
|
declare function renderApplyResult(result: SyncApplyResult): string;
|
|
1291
1219
|
|
|
1220
|
+
type ScenarioChangeKind = "added" | "removed" | "renamed" | "moved" | "regressed" | "fixed" | "changed" | "unchanged";
|
|
1221
|
+
interface ScenarioChangeFlags {
|
|
1222
|
+
status: boolean;
|
|
1223
|
+
steps: boolean;
|
|
1224
|
+
docs: boolean;
|
|
1225
|
+
tags: boolean;
|
|
1226
|
+
tickets: boolean;
|
|
1227
|
+
source: boolean;
|
|
1228
|
+
duration: boolean;
|
|
1229
|
+
attachments: boolean;
|
|
1230
|
+
error: boolean;
|
|
1231
|
+
titlePath: boolean;
|
|
1232
|
+
}
|
|
1233
|
+
interface ScenarioSnapshot {
|
|
1234
|
+
id: string;
|
|
1235
|
+
scenario: string;
|
|
1236
|
+
sourceFile: string;
|
|
1237
|
+
sourceLine: number;
|
|
1238
|
+
status: TestStatus;
|
|
1239
|
+
durationMs: number;
|
|
1240
|
+
tags: string[];
|
|
1241
|
+
titlePath: string[];
|
|
1242
|
+
steps: StoryStep[];
|
|
1243
|
+
docs: DocEntry[];
|
|
1244
|
+
tickets: NormalizedTicket[];
|
|
1245
|
+
attachments: Attachment[];
|
|
1246
|
+
errorMessage?: string;
|
|
1247
|
+
}
|
|
1248
|
+
interface ScenarioDiff {
|
|
1249
|
+
kind: ScenarioChangeKind;
|
|
1250
|
+
id: string;
|
|
1251
|
+
scenario: string;
|
|
1252
|
+
sourceFile: string;
|
|
1253
|
+
sourceLine: number;
|
|
1254
|
+
baseline?: ScenarioSnapshot;
|
|
1255
|
+
current?: ScenarioSnapshot;
|
|
1256
|
+
flags: ScenarioChangeFlags;
|
|
1257
|
+
changedFields: string[];
|
|
1258
|
+
durationDeltaMs?: number;
|
|
1259
|
+
/** For `renamed`/`moved`: the baseline test-case id this behaviour was matched from. */
|
|
1260
|
+
previousId?: string;
|
|
1261
|
+
/** For `renamed`/`moved`: match confidence in 0..1 (1 = exact content fingerprint). */
|
|
1262
|
+
matchConfidence?: number;
|
|
1263
|
+
/** For `renamed`/`moved`: how the baseline/current pair was re-identified. */
|
|
1264
|
+
matchedBy?: "fingerprint" | "similarity";
|
|
1265
|
+
}
|
|
1266
|
+
interface RunDiffSummary {
|
|
1267
|
+
totalBaseline: number;
|
|
1268
|
+
totalCurrent: number;
|
|
1269
|
+
added: number;
|
|
1270
|
+
removed: number;
|
|
1271
|
+
/** Behaviours re-identified across a title change (content preserved). */
|
|
1272
|
+
renamed: number;
|
|
1273
|
+
/** Behaviours re-identified across a file move (content preserved). */
|
|
1274
|
+
moved: number;
|
|
1275
|
+
changed: number;
|
|
1276
|
+
regressed: number;
|
|
1277
|
+
fixed: number;
|
|
1278
|
+
unchanged: number;
|
|
1279
|
+
/**
|
|
1280
|
+
* Baseline scenarios skipped because the current run is partial and never
|
|
1281
|
+
* touched their source file. Always 0 for a full-run diff.
|
|
1282
|
+
*/
|
|
1283
|
+
notRun: number;
|
|
1284
|
+
}
|
|
1285
|
+
interface RunDiffResult {
|
|
1286
|
+
baseline: TestRunResult;
|
|
1287
|
+
current: TestRunResult;
|
|
1288
|
+
summary: RunDiffSummary;
|
|
1289
|
+
scenarios: ScenarioDiff[];
|
|
1290
|
+
}
|
|
1291
|
+
type CompareFormat = "html" | "markdown" | "changelog";
|
|
1292
|
+
interface CompareFormatterOptions {
|
|
1293
|
+
title?: string;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1292
1296
|
/**
|
|
1293
1297
|
* Diff types — parsed unified patches and content-anchored annotation targets.
|
|
1294
1298
|
*
|
|
@@ -1997,6 +2001,10 @@ declare class MarkdownFormatter {
|
|
|
1997
2001
|
* Render scenarios grouped by file.
|
|
1998
2002
|
*/
|
|
1999
2003
|
private renderByFile;
|
|
2004
|
+
/**
|
|
2005
|
+
* Render what a feature is for, ahead of the scenarios that prove it.
|
|
2006
|
+
*/
|
|
2007
|
+
private renderFeatureDeclaration;
|
|
2000
2008
|
/**
|
|
2001
2009
|
* Render scenarios grouped by suite path.
|
|
2002
2010
|
*/
|
|
@@ -2717,6 +2725,19 @@ interface CheckFailure {
|
|
|
2717
2725
|
/** True when this scenario was passing in the baseline run. */
|
|
2718
2726
|
regressed: boolean;
|
|
2719
2727
|
}
|
|
2728
|
+
/**
|
|
2729
|
+
* A scenario that is switched off: skipped or pending, but not `it.todo`.
|
|
2730
|
+
* A planned scenario is a spec waiting for code; a turned-off one is a spec
|
|
2731
|
+
* you stopped validating, and the pack forgets it exists unless it is named.
|
|
2732
|
+
*/
|
|
2733
|
+
interface CheckTurnedOff {
|
|
2734
|
+
id: string;
|
|
2735
|
+
scenario: string;
|
|
2736
|
+
/** `sourceFile:sourceLine` */
|
|
2737
|
+
location: string;
|
|
2738
|
+
status: "skipped" | "pending";
|
|
2739
|
+
tickets: string[];
|
|
2740
|
+
}
|
|
2720
2741
|
interface CheckReport {
|
|
2721
2742
|
summary: {
|
|
2722
2743
|
total: number;
|
|
@@ -2726,6 +2747,8 @@ interface CheckReport {
|
|
|
2726
2747
|
pending: number;
|
|
2727
2748
|
};
|
|
2728
2749
|
failures: CheckFailure[];
|
|
2750
|
+
/** Scenarios switched off — named, not just counted (see {@link CheckTurnedOff}). */
|
|
2751
|
+
turnedOff: CheckTurnedOff[];
|
|
2729
2752
|
/** Count of scenarios that went passed → failed vs. the baseline. */
|
|
2730
2753
|
regressed: number;
|
|
2731
2754
|
/** Count of scenarios that went failed → passed vs. the baseline. */
|
|
@@ -2844,7 +2867,100 @@ type TriageDeps = Record<string, never>;
|
|
|
2844
2867
|
declare function buildTriage(args: TriageArgs, _deps?: TriageDeps): TriageReport;
|
|
2845
2868
|
declare function renderTriage(report: TriageReport, format: "text" | "json"): string;
|
|
2846
2869
|
|
|
2847
|
-
|
|
2870
|
+
/**
|
|
2871
|
+
* ReportGenerator — turns a canonical TestRunResult into report files.
|
|
2872
|
+
*
|
|
2873
|
+
* Its own module rather than part of the package barrel: `watch.ts` needs the
|
|
2874
|
+
* generator, and reaching for it through `./index` would pull every formatter
|
|
2875
|
+
* and the React SSR path into that module's graph.
|
|
2876
|
+
*/
|
|
2877
|
+
|
|
2878
|
+
/** Arguments for generate function */
|
|
2879
|
+
interface GenerateArgs {
|
|
2880
|
+
/** Canonical test run result */
|
|
2881
|
+
run: TestRunResult;
|
|
2882
|
+
/** Optional options override */
|
|
2883
|
+
options?: FormatterOptions;
|
|
2884
|
+
}
|
|
2885
|
+
/** Dependencies for generate function (injectable for testing) */
|
|
2886
|
+
interface GenerateDeps {
|
|
2887
|
+
/** Logger for warnings */
|
|
2888
|
+
logger: Logger;
|
|
2889
|
+
/** File writer function */
|
|
2890
|
+
writeFile: WriteFile;
|
|
2891
|
+
}
|
|
2892
|
+
/** Result of generate function: Map of format to array of file paths */
|
|
2893
|
+
type GenerateResult = Map<OutputFormat, string[]>;
|
|
2894
|
+
interface GenerateCompareResult {
|
|
2895
|
+
files: string[];
|
|
2896
|
+
diff: RunDiffResult;
|
|
2897
|
+
}
|
|
2898
|
+
/**
|
|
2899
|
+
* Join an output name with a format extension, collapsing a stutter when the
|
|
2900
|
+
* chosen name already carries the format's tag. With the default name "index",
|
|
2901
|
+
* `story-report-json` writes `index.story-report.json`; but if the caller names
|
|
2902
|
+
* the file `story-report`, this yields `story-report.json`, not
|
|
2903
|
+
* `story-report.story-report.json`.
|
|
2904
|
+
*/
|
|
2905
|
+
declare function joinNameAndExt(name: string, ext: string): string;
|
|
2906
|
+
/**
|
|
2907
|
+
* Normalise input formats to canonical {@link OutputFormat}s. Accepts the
|
|
2908
|
+
* deprecated `"astro"` alias (renamed to `"astro-markdown"`) and warns once per
|
|
2909
|
+
* process — so programmatic/config callers passing `"astro"` keep working
|
|
2910
|
+
* instead of throwing, matching the CLI's deprecation behaviour.
|
|
2911
|
+
*/
|
|
2912
|
+
declare function normalizeFormats(formats: ReadonlyArray<FormatInput>): OutputFormat[];
|
|
2913
|
+
declare class ReportGenerator {
|
|
2914
|
+
private options;
|
|
2915
|
+
private deps;
|
|
2916
|
+
constructor(options?: FormatterOptions, deps?: Partial<GenerateDeps>);
|
|
2917
|
+
/**
|
|
2918
|
+
* Resolve options with defaults.
|
|
2919
|
+
*/
|
|
2920
|
+
private resolveOptions;
|
|
2921
|
+
/**
|
|
2922
|
+
* Generate reports for a test run.
|
|
2923
|
+
*
|
|
2924
|
+
* @param run - Canonical TestRunResult (use canonicalizeRun to create from RawRun)
|
|
2925
|
+
* @returns Map of output format to generated file paths
|
|
2926
|
+
*/
|
|
2927
|
+
generate(run: TestRunResult): Promise<GenerateResult>;
|
|
2928
|
+
/**
|
|
2929
|
+
* Whether any output is colocated — the global mode, or any per-rule mode.
|
|
2930
|
+
* A colocated rule under a global aggregated mode still writes per-file
|
|
2931
|
+
* reports that need an index.
|
|
2932
|
+
*/
|
|
2933
|
+
private hasColocatedOutput;
|
|
2934
|
+
/**
|
|
2935
|
+
* Write the entry-point page for a colocated HTML report tree. `htmlPaths` is
|
|
2936
|
+
* every HTML report already written this run. Returns the path written, or
|
|
2937
|
+
* undefined when there is nothing to index or the index would clobber a report
|
|
2938
|
+
* already at `index.html` — a colocated source file that produces it, or, in
|
|
2939
|
+
* mixed mode, the global aggregate (whose default output name is also index).
|
|
2940
|
+
*/
|
|
2941
|
+
private writeColocatedIndex;
|
|
2942
|
+
/**
|
|
2943
|
+
* Generate reports for a single format.
|
|
2944
|
+
*/
|
|
2945
|
+
private generateFormat;
|
|
2946
|
+
/**
|
|
2947
|
+
* Format content for a specific format.
|
|
2948
|
+
*/
|
|
2949
|
+
private formatContent;
|
|
2950
|
+
/**
|
|
2951
|
+
* Render a standalone HTML report via the shared React component tree
|
|
2952
|
+
* (executable-stories-react). This is the same renderer the Astro docs site
|
|
2953
|
+
* uses, so the two outputs cannot drift. Imported lazily so React stays out
|
|
2954
|
+
* of the eager bundle unless this format is requested.
|
|
2955
|
+
*/
|
|
2956
|
+
private formatHtmlReact;
|
|
2957
|
+
}
|
|
2958
|
+
/**
|
|
2959
|
+
* Factory function to create a ReportGenerator with dependency injection.
|
|
2960
|
+
*
|
|
2961
|
+
* Useful for testing and custom configurations.
|
|
2962
|
+
*/
|
|
2963
|
+
declare function createReportGenerator(options?: FormatterOptions, deps?: Partial<GenerateDeps>): ReportGenerator;
|
|
2848
2964
|
|
|
2849
2965
|
interface DiffRunsOptions {
|
|
2850
2966
|
/**
|
|
@@ -2861,6 +2977,8 @@ interface DiffRunsOptions {
|
|
|
2861
2977
|
}
|
|
2862
2978
|
declare function diffRuns(baseline: TestRunResult, current: TestRunResult, options?: DiffRunsOptions): RunDiffResult;
|
|
2863
2979
|
|
|
2980
|
+
declare function createPrCommentSummary(diff: RunDiffResult, maxScenarios?: number): string;
|
|
2981
|
+
|
|
2864
2982
|
/**
|
|
2865
2983
|
* Review domain — `buildReview(run, context)` mirrors `diffRuns(baseline, current)`.
|
|
2866
2984
|
*
|
|
@@ -3239,92 +3357,6 @@ declare function toTraceabilityMatrix(run: TestRunResult): TraceabilityMatrix;
|
|
|
3239
3357
|
* HTML report renders via executable-stories-react — the `html` format)
|
|
3240
3358
|
*/
|
|
3241
3359
|
|
|
3242
|
-
/** Arguments for generate function */
|
|
3243
|
-
interface GenerateArgs {
|
|
3244
|
-
/** Canonical test run result */
|
|
3245
|
-
run: TestRunResult;
|
|
3246
|
-
/** Optional options override */
|
|
3247
|
-
options?: FormatterOptions;
|
|
3248
|
-
}
|
|
3249
|
-
/** Dependencies for generate function (injectable for testing) */
|
|
3250
|
-
interface GenerateDeps {
|
|
3251
|
-
/** Logger for warnings */
|
|
3252
|
-
logger: Logger;
|
|
3253
|
-
/** File writer function */
|
|
3254
|
-
writeFile: WriteFile;
|
|
3255
|
-
}
|
|
3256
|
-
/** Result of generate function: Map of format to array of file paths */
|
|
3257
|
-
type GenerateResult = Map<OutputFormat, string[]>;
|
|
3258
|
-
interface GenerateCompareResult {
|
|
3259
|
-
files: string[];
|
|
3260
|
-
diff: RunDiffResult;
|
|
3261
|
-
}
|
|
3262
|
-
/**
|
|
3263
|
-
* Join an output name with a format extension, collapsing a stutter when the
|
|
3264
|
-
* chosen name already carries the format's tag. With the default name "index",
|
|
3265
|
-
* `story-report-json` writes `index.story-report.json`; but if the caller names
|
|
3266
|
-
* the file `story-report`, this yields `story-report.json`, not
|
|
3267
|
-
* `story-report.story-report.json`.
|
|
3268
|
-
*/
|
|
3269
|
-
declare function joinNameAndExt(name: string, ext: string): string;
|
|
3270
|
-
/**
|
|
3271
|
-
* Normalise input formats to canonical {@link OutputFormat}s. Accepts the
|
|
3272
|
-
* deprecated `"astro"` alias (renamed to `"astro-markdown"`) and warns once per
|
|
3273
|
-
* process — so programmatic/config callers passing `"astro"` keep working
|
|
3274
|
-
* instead of throwing, matching the CLI's deprecation behaviour.
|
|
3275
|
-
*/
|
|
3276
|
-
declare function normalizeFormats(formats: ReadonlyArray<FormatInput>): OutputFormat[];
|
|
3277
|
-
declare class ReportGenerator {
|
|
3278
|
-
private options;
|
|
3279
|
-
private deps;
|
|
3280
|
-
constructor(options?: FormatterOptions, deps?: Partial<GenerateDeps>);
|
|
3281
|
-
/**
|
|
3282
|
-
* Resolve options with defaults.
|
|
3283
|
-
*/
|
|
3284
|
-
private resolveOptions;
|
|
3285
|
-
/**
|
|
3286
|
-
* Generate reports for a test run.
|
|
3287
|
-
*
|
|
3288
|
-
* @param run - Canonical TestRunResult (use canonicalizeRun to create from RawRun)
|
|
3289
|
-
* @returns Map of output format to generated file paths
|
|
3290
|
-
*/
|
|
3291
|
-
generate(run: TestRunResult): Promise<GenerateResult>;
|
|
3292
|
-
/**
|
|
3293
|
-
* Whether any output is colocated — the global mode, or any per-rule mode.
|
|
3294
|
-
* A colocated rule under a global aggregated mode still writes per-file
|
|
3295
|
-
* reports that need an index.
|
|
3296
|
-
*/
|
|
3297
|
-
private hasColocatedOutput;
|
|
3298
|
-
/**
|
|
3299
|
-
* Write the entry-point page for a colocated HTML report tree. `htmlPaths` is
|
|
3300
|
-
* every HTML report already written this run. Returns the path written, or
|
|
3301
|
-
* undefined when there is nothing to index or the index would clobber a report
|
|
3302
|
-
* already at `index.html` — a colocated source file that produces it, or, in
|
|
3303
|
-
* mixed mode, the global aggregate (whose default output name is also index).
|
|
3304
|
-
*/
|
|
3305
|
-
private writeColocatedIndex;
|
|
3306
|
-
/**
|
|
3307
|
-
* Generate reports for a single format.
|
|
3308
|
-
*/
|
|
3309
|
-
private generateFormat;
|
|
3310
|
-
/**
|
|
3311
|
-
* Format content for a specific format.
|
|
3312
|
-
*/
|
|
3313
|
-
private formatContent;
|
|
3314
|
-
/**
|
|
3315
|
-
* Render a standalone HTML report via the shared React component tree
|
|
3316
|
-
* (executable-stories-react). This is the same renderer the Astro docs site
|
|
3317
|
-
* uses, so the two outputs cannot drift. Imported lazily so React stays out
|
|
3318
|
-
* of the eager bundle unless this format is requested.
|
|
3319
|
-
*/
|
|
3320
|
-
private formatHtmlReact;
|
|
3321
|
-
}
|
|
3322
|
-
/**
|
|
3323
|
-
* Factory function to create a ReportGenerator with dependency injection.
|
|
3324
|
-
*
|
|
3325
|
-
* Useful for testing and custom configurations.
|
|
3326
|
-
*/
|
|
3327
|
-
declare function createReportGenerator(options?: FormatterOptions, deps?: Partial<GenerateDeps>): ReportGenerator;
|
|
3328
3360
|
declare function generateRunComparison(args: {
|
|
3329
3361
|
baseline: TestRunResult;
|
|
3330
3362
|
current: TestRunResult;
|