executable-stories-formatters 0.7.7 → 0.7.8

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
@@ -661,6 +661,15 @@ interface IJsonFeature {
661
661
  uri: string;
662
662
  }
663
663
 
664
+ interface Formatter {
665
+ name: string;
666
+ fileExtension?: string;
667
+ format(run: TestRunResult): string;
668
+ }
669
+ interface ExecutableStoriesConfig {
670
+ formatters?: Record<string, Formatter>;
671
+ }
672
+
664
673
  /**
665
674
  * Render an OTel trace waterfall (fn(args, deps)).
666
675
  */
@@ -2227,7 +2236,7 @@ declare function hasSufficientHistory(entries: unknown[], min: number): boolean;
2227
2236
 
2228
2237
  interface ListScenariosArgs {
2229
2238
  testCases: TestCaseResult[];
2230
- format: "text" | "json";
2239
+ format: "text" | "json" | "csv" | "markdown-table";
2231
2240
  }
2232
2241
  type ListScenariosDeps = Record<string, never>;
2233
2242
  declare function listScenarios(args: ListScenariosArgs, _deps: ListScenariosDeps): string;
@@ -2355,4 +2364,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
2355
2364
  */
2356
2365
  declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
2357
2366
 
2358
- export { type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, type Attachment, type BundleOptions, type BundleResult, type CIInfo, CIProvider, type CanonicalizeOptions, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type CopyMarkdownAssetsOptions, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type FlakinessLevel, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type HistoryEntry, type HistoryStore, HtmlFormatter, type HtmlOptions, type HtmlTheme, type HtmlThemeName, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type ListScenariosArgs, type ListScenariosDeps, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, NormalizedTicket, type NotificationSummary, type NotifyCondition, OtelSpan, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, type PerformanceTrend, RawAttachment, RawCIInfo, RawRun, RawStatus, ReportGenerator, type ResolvedFormatterOptions, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, type StepResult, StoryMeta, StoryStep, type TestCaseAttempt, type TestCaseResult, type TestHistory, type TestMetrics, type TestRunResult, type TestStatus, CIInfo$1 as TypedCIInfo, type ValidationResult, type WebhookPayload, type WebhookSignerHmac, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, bundleAssets, calculateFlakiness, calculateStability, canonicalizeRun, clearVersionCache, computeTestMetrics, copyMarkdownAssets, createPrCommentSummary, createReportGenerator, deriveStepResults, detectCI, detectPerformanceTrend, diffRuns, findGitDir, formatDuration, generateRunComparison, generateRunId, generateTestCaseId, getAvailableThemes, getCssOnlyThemes, hasSufficientHistory, listScenarios, loadHistory, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, readBranchName, readGitSha, readPackageVersion, resolveAttachment, resolveAttachments, resolveTheme, resolveTraceUrl, rewriteAssetPaths, saveHistory, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, signBody, slugify, stripAnsi, tryGetActiveOtelContext, updateHistory, validateCanonicalRun };
2367
+ export { type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, type Attachment, type BundleOptions, type BundleResult, type CIInfo, CIProvider, type CanonicalizeOptions, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type CopyMarkdownAssetsOptions, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type ExecutableStoriesConfig, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type HistoryEntry, type HistoryStore, HtmlFormatter, type HtmlOptions, type HtmlTheme, type HtmlThemeName, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type ListScenariosArgs, type ListScenariosDeps, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, NormalizedTicket, type NotificationSummary, type NotifyCondition, OtelSpan, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, type PerformanceTrend, RawAttachment, RawCIInfo, RawRun, RawStatus, ReportGenerator, type ResolvedFormatterOptions, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, type StepResult, StoryMeta, StoryStep, type TestCaseAttempt, type TestCaseResult, type TestHistory, type TestMetrics, type TestRunResult, type TestStatus, CIInfo$1 as TypedCIInfo, type ValidationResult, type WebhookPayload, type WebhookSignerHmac, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, bundleAssets, calculateFlakiness, calculateStability, canonicalizeRun, clearVersionCache, computeTestMetrics, copyMarkdownAssets, createPrCommentSummary, createReportGenerator, deriveStepResults, detectCI, detectPerformanceTrend, diffRuns, findGitDir, formatDuration, generateRunComparison, generateRunId, generateTestCaseId, getAvailableThemes, getCssOnlyThemes, hasSufficientHistory, listScenarios, loadHistory, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, readBranchName, readGitSha, readPackageVersion, resolveAttachment, resolveAttachments, resolveTheme, resolveTraceUrl, rewriteAssetPaths, saveHistory, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, signBody, slugify, stripAnsi, tryGetActiveOtelContext, updateHistory, validateCanonicalRun };
package/dist/index.d.ts CHANGED
@@ -661,6 +661,15 @@ interface IJsonFeature {
661
661
  uri: string;
662
662
  }
663
663
 
664
+ interface Formatter {
665
+ name: string;
666
+ fileExtension?: string;
667
+ format(run: TestRunResult): string;
668
+ }
669
+ interface ExecutableStoriesConfig {
670
+ formatters?: Record<string, Formatter>;
671
+ }
672
+
664
673
  /**
665
674
  * Render an OTel trace waterfall (fn(args, deps)).
666
675
  */
@@ -2227,7 +2236,7 @@ declare function hasSufficientHistory(entries: unknown[], min: number): boolean;
2227
2236
 
2228
2237
  interface ListScenariosArgs {
2229
2238
  testCases: TestCaseResult[];
2230
- format: "text" | "json";
2239
+ format: "text" | "json" | "csv" | "markdown-table";
2231
2240
  }
2232
2241
  type ListScenariosDeps = Record<string, never>;
2233
2242
  declare function listScenarios(args: ListScenariosArgs, _deps: ListScenariosDeps): string;
@@ -2355,4 +2364,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
2355
2364
  */
2356
2365
  declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
2357
2366
 
2358
- export { type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, type Attachment, type BundleOptions, type BundleResult, type CIInfo, CIProvider, type CanonicalizeOptions, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type CopyMarkdownAssetsOptions, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type FlakinessLevel, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type HistoryEntry, type HistoryStore, HtmlFormatter, type HtmlOptions, type HtmlTheme, type HtmlThemeName, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type ListScenariosArgs, type ListScenariosDeps, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, NormalizedTicket, type NotificationSummary, type NotifyCondition, OtelSpan, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, type PerformanceTrend, RawAttachment, RawCIInfo, RawRun, RawStatus, ReportGenerator, type ResolvedFormatterOptions, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, type StepResult, StoryMeta, StoryStep, type TestCaseAttempt, type TestCaseResult, type TestHistory, type TestMetrics, type TestRunResult, type TestStatus, CIInfo$1 as TypedCIInfo, type ValidationResult, type WebhookPayload, type WebhookSignerHmac, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, bundleAssets, calculateFlakiness, calculateStability, canonicalizeRun, clearVersionCache, computeTestMetrics, copyMarkdownAssets, createPrCommentSummary, createReportGenerator, deriveStepResults, detectCI, detectPerformanceTrend, diffRuns, findGitDir, formatDuration, generateRunComparison, generateRunId, generateTestCaseId, getAvailableThemes, getCssOnlyThemes, hasSufficientHistory, listScenarios, loadHistory, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, readBranchName, readGitSha, readPackageVersion, resolveAttachment, resolveAttachments, resolveTheme, resolveTraceUrl, rewriteAssetPaths, saveHistory, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, signBody, slugify, stripAnsi, tryGetActiveOtelContext, updateHistory, validateCanonicalRun };
2367
+ export { type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, type Attachment, type BundleOptions, type BundleResult, type CIInfo, CIProvider, type CanonicalizeOptions, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type CopyMarkdownAssetsOptions, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type ExecutableStoriesConfig, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type HistoryEntry, type HistoryStore, HtmlFormatter, type HtmlOptions, type HtmlTheme, type HtmlThemeName, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type ListScenariosArgs, type ListScenariosDeps, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, NormalizedTicket, type NotificationSummary, type NotifyCondition, OtelSpan, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, type PerformanceTrend, RawAttachment, RawCIInfo, RawRun, RawStatus, ReportGenerator, type ResolvedFormatterOptions, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, type StepResult, StoryMeta, StoryStep, type TestCaseAttempt, type TestCaseResult, type TestHistory, type TestMetrics, type TestRunResult, type TestStatus, CIInfo$1 as TypedCIInfo, type ValidationResult, type WebhookPayload, type WebhookSignerHmac, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, bundleAssets, calculateFlakiness, calculateStability, canonicalizeRun, clearVersionCache, computeTestMetrics, copyMarkdownAssets, createPrCommentSummary, createReportGenerator, deriveStepResults, detectCI, detectPerformanceTrend, diffRuns, findGitDir, formatDuration, generateRunComparison, generateRunId, generateTestCaseId, getAvailableThemes, getCssOnlyThemes, hasSufficientHistory, listScenarios, loadHistory, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, readBranchName, readGitSha, readPackageVersion, resolveAttachment, resolveAttachments, resolveTheme, resolveTraceUrl, rewriteAssetPaths, saveHistory, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, signBody, slugify, stripAnsi, tryGetActiveOtelContext, updateHistory, validateCanonicalRun };
package/dist/index.js CHANGED
@@ -18091,6 +18091,37 @@ function listScenarios(args, _deps) {
18091
18091
  }));
18092
18092
  return JSON.stringify(items, null, 2);
18093
18093
  }
18094
+ if (format === "csv") {
18095
+ const header = "id,scenario,status,sourceFile,sourceLine,tags";
18096
+ const rows = testCases.map((tc) => {
18097
+ const fields = [
18098
+ tc.id,
18099
+ tc.story.scenario,
18100
+ tc.status,
18101
+ tc.sourceFile,
18102
+ String(tc.sourceLine),
18103
+ tc.tags.join(" ")
18104
+ ];
18105
+ return fields.map((f) => {
18106
+ if (f.includes(",") || f.includes('"') || f.includes("\n")) {
18107
+ return `"${f.replace(/"/g, '""')}"`;
18108
+ }
18109
+ return f;
18110
+ }).join(",");
18111
+ });
18112
+ return [header, ...rows].join("\n");
18113
+ }
18114
+ if (format === "markdown-table") {
18115
+ const header = "| Status | Scenario | Location | Tags |";
18116
+ const divider = "|--------|----------|----------|------|";
18117
+ const rows = testCases.map((tc) => {
18118
+ const icon = STATUS_ICONS[tc.status] ?? "?";
18119
+ const location = `${tc.sourceFile}:${tc.sourceLine}`;
18120
+ const tags = tc.tags.map((t) => `@${t}`).join(" ");
18121
+ return `| ${icon} | ${tc.story.scenario} | ${location} | ${tags} |`;
18122
+ });
18123
+ return [header, divider, ...rows].join("\n");
18124
+ }
18094
18125
  if (testCases.length === 0) {
18095
18126
  return "No scenarios found.";
18096
18127
  }