executable-stories-formatters 0.7.7 → 0.7.9
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/README.md +1 -0
- package/dist/cli.js +1118 -96
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +756 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +212 -6
- package/dist/index.d.ts +212 -6
- package/dist/index.js +753 -52
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -172,6 +172,79 @@ interface WebhookPayload {
|
|
|
172
172
|
summary: NotificationSummary;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Confluence (ADF) Formatter — Layer 3.
|
|
177
|
+
*
|
|
178
|
+
* Emits Atlassian Document Format JSON. Suitable for Confluence pages
|
|
179
|
+
* and Jira issue descriptions via the REST API. Built directly from
|
|
180
|
+
* TestRunResult so code blocks, tables, links, and mermaid all round-trip
|
|
181
|
+
* with higher fidelity than converting markdown → ADF.
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
/** Options for ConfluenceFormatter */
|
|
185
|
+
interface ConfluenceFormatterOptions {
|
|
186
|
+
/** Page title. Default: "User Stories" */
|
|
187
|
+
title?: string;
|
|
188
|
+
/** Include status icons (emoji) in scenario headings. Default: true */
|
|
189
|
+
includeStatusIcons?: boolean;
|
|
190
|
+
/** Include metadata table (date, version). Default: true */
|
|
191
|
+
includeMetadata?: boolean;
|
|
192
|
+
/** Include summary table (counts, duration). Default: true */
|
|
193
|
+
includeSummaryTable?: boolean;
|
|
194
|
+
/** Include error details for failed scenarios. Default: true */
|
|
195
|
+
includeErrors?: boolean;
|
|
196
|
+
/** Scenario heading level (1-6). Default: 3 */
|
|
197
|
+
scenarioHeadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
198
|
+
/** Group scenarios by. Default: "file" */
|
|
199
|
+
groupBy?: "file" | "suite" | "none";
|
|
200
|
+
/** Sort scenarios. Default: "source" */
|
|
201
|
+
sortScenarios?: "alpha" | "source" | "none";
|
|
202
|
+
/** Pretty-print JSON output. Default: true */
|
|
203
|
+
pretty?: boolean;
|
|
204
|
+
/** Base URL for source permalinks (Git). Rendered as link marks */
|
|
205
|
+
permalinkBaseUrl?: string;
|
|
206
|
+
/** URL template for ticket links. Use {ticket} as placeholder */
|
|
207
|
+
ticketUrlTemplate?: string;
|
|
208
|
+
}
|
|
209
|
+
interface AdfMark {
|
|
210
|
+
type: string;
|
|
211
|
+
attrs?: Record<string, unknown>;
|
|
212
|
+
}
|
|
213
|
+
interface AdfNode {
|
|
214
|
+
type: string;
|
|
215
|
+
attrs?: Record<string, unknown>;
|
|
216
|
+
content?: AdfNode[];
|
|
217
|
+
marks?: AdfMark[];
|
|
218
|
+
text?: string;
|
|
219
|
+
/** Only on the root doc node */
|
|
220
|
+
version?: number;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Confluence / Atlassian Document Format formatter.
|
|
224
|
+
*
|
|
225
|
+
* Emits a top-level `{ version: 1, type: "doc", content: [...] }` tree that
|
|
226
|
+
* can be posted to the Confluence or Jira REST API.
|
|
227
|
+
*/
|
|
228
|
+
declare class ConfluenceFormatter {
|
|
229
|
+
private options;
|
|
230
|
+
constructor(options?: ConfluenceFormatterOptions);
|
|
231
|
+
/** Build the ADF document tree. Returns the JS object (not stringified). */
|
|
232
|
+
formatToAdf(run: TestRunResult): AdfNode;
|
|
233
|
+
/** Format a test run as an ADF JSON string. */
|
|
234
|
+
format(run: TestRunResult): string;
|
|
235
|
+
private renderMetadataTable;
|
|
236
|
+
private renderSummaryTable;
|
|
237
|
+
private renderByFile;
|
|
238
|
+
private renderBySuite;
|
|
239
|
+
private renderFlat;
|
|
240
|
+
private renderSuiteGroups;
|
|
241
|
+
private renderScenario;
|
|
242
|
+
private renderStepsList;
|
|
243
|
+
private renderDocEntry;
|
|
244
|
+
private sortCases;
|
|
245
|
+
private sortSuiteGroups;
|
|
246
|
+
}
|
|
247
|
+
|
|
175
248
|
/**
|
|
176
249
|
* Configuration options for ACL and formatters.
|
|
177
250
|
*/
|
|
@@ -200,7 +273,7 @@ interface CanonicalizeOptions {
|
|
|
200
273
|
};
|
|
201
274
|
}
|
|
202
275
|
/** Output format for report generation */
|
|
203
|
-
type OutputFormat = "astro" | "cucumber-json" | "cucumber-messages" | "cucumber-html" | "html" | "junit" | "markdown";
|
|
276
|
+
type OutputFormat = "astro" | "confluence" | "cucumber-json" | "cucumber-messages" | "cucumber-html" | "html" | "junit" | "markdown";
|
|
204
277
|
/** Sort order for test cases in reports (deterministic for diff-friendly output) */
|
|
205
278
|
type SortTestCasesMode = "id" | "source" | "none";
|
|
206
279
|
/** Output mode for report routing */
|
|
@@ -320,6 +393,8 @@ interface FormatterOptions {
|
|
|
320
393
|
markdown?: MarkdownFormatterOptions;
|
|
321
394
|
/** Astro/Starlight specific options */
|
|
322
395
|
astro?: AstroFormatterOptions$1;
|
|
396
|
+
/** Confluence/ADF specific options */
|
|
397
|
+
confluence?: ConfluenceFormatterOptions;
|
|
323
398
|
/** History tracking options */
|
|
324
399
|
history?: {
|
|
325
400
|
/** Path to JSON history file (enables tracking) */
|
|
@@ -473,6 +548,19 @@ interface ResolvedFormatterOptions {
|
|
|
473
548
|
includeSourceLinks: boolean;
|
|
474
549
|
customRenderers?: MarkdownRenderers;
|
|
475
550
|
};
|
|
551
|
+
confluence: {
|
|
552
|
+
title: string;
|
|
553
|
+
includeStatusIcons: boolean;
|
|
554
|
+
includeMetadata: boolean;
|
|
555
|
+
includeSummaryTable: boolean;
|
|
556
|
+
includeErrors: boolean;
|
|
557
|
+
scenarioHeadingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
558
|
+
groupBy: "file" | "suite" | "none";
|
|
559
|
+
sortScenarios: "alpha" | "source" | "none";
|
|
560
|
+
pretty: boolean;
|
|
561
|
+
permalinkBaseUrl?: string;
|
|
562
|
+
ticketUrlTemplate?: string;
|
|
563
|
+
};
|
|
476
564
|
astro: {
|
|
477
565
|
assetsDir: string;
|
|
478
566
|
assetsBaseUrl: string;
|
|
@@ -661,6 +749,15 @@ interface IJsonFeature {
|
|
|
661
749
|
uri: string;
|
|
662
750
|
}
|
|
663
751
|
|
|
752
|
+
interface Formatter {
|
|
753
|
+
name: string;
|
|
754
|
+
fileExtension?: string;
|
|
755
|
+
format(run: TestRunResult): string;
|
|
756
|
+
}
|
|
757
|
+
interface ExecutableStoriesConfig {
|
|
758
|
+
formatters?: Record<string, Formatter>;
|
|
759
|
+
}
|
|
760
|
+
|
|
664
761
|
/**
|
|
665
762
|
* Render an OTel trace waterfall (fn(args, deps)).
|
|
666
763
|
*/
|
|
@@ -1429,10 +1526,11 @@ declare class MarkdownFormatter {
|
|
|
1429
1526
|
}
|
|
1430
1527
|
|
|
1431
1528
|
/**
|
|
1432
|
-
* Astro
|
|
1529
|
+
* Astro Formatter - Layer 3.
|
|
1433
1530
|
*
|
|
1434
|
-
* Wraps the MarkdownFormatter to produce
|
|
1435
|
-
*
|
|
1531
|
+
* Wraps the MarkdownFormatter to produce .md files with YAML frontmatter
|
|
1532
|
+
* (title, description, sidebar.badge) for Starlight content collections.
|
|
1533
|
+
* The scaffolded docs site uses themed CSS matching the HTML report design system.
|
|
1436
1534
|
*/
|
|
1437
1535
|
|
|
1438
1536
|
interface StarlightBadge {
|
|
@@ -1452,6 +1550,114 @@ declare class AstroFormatter {
|
|
|
1452
1550
|
static computeBadge(testCases: Pick<TestCaseResult, "status">[]): StarlightBadge;
|
|
1453
1551
|
}
|
|
1454
1552
|
|
|
1553
|
+
/**
|
|
1554
|
+
* Confluence publisher.
|
|
1555
|
+
*
|
|
1556
|
+
* Pushes an ADF JSON document to a Confluence Cloud page via the REST API v2.
|
|
1557
|
+
* - If `pageId` is provided, the page is updated in place (title + body + version).
|
|
1558
|
+
* - If `spaceId` is provided instead, a new page is created (optionally under `parentId`).
|
|
1559
|
+
*
|
|
1560
|
+
* Authentication: Basic auth with an Atlassian email + API token.
|
|
1561
|
+
* Generate tokens at https://id.atlassian.com/manage-profile/security/api-tokens.
|
|
1562
|
+
*/
|
|
1563
|
+
/** HTTP fetch function (injectable for tests). Matches global fetch signature. */
|
|
1564
|
+
type FetchFn = (url: string, init: {
|
|
1565
|
+
method: string;
|
|
1566
|
+
headers: Record<string, string>;
|
|
1567
|
+
body?: string;
|
|
1568
|
+
}) => Promise<{
|
|
1569
|
+
ok: boolean;
|
|
1570
|
+
status: number;
|
|
1571
|
+
statusText: string;
|
|
1572
|
+
text(): Promise<string>;
|
|
1573
|
+
json(): Promise<unknown>;
|
|
1574
|
+
}>;
|
|
1575
|
+
interface ConfluenceAuth {
|
|
1576
|
+
/** Atlassian account email */
|
|
1577
|
+
email: string;
|
|
1578
|
+
/** Atlassian API token */
|
|
1579
|
+
token: string;
|
|
1580
|
+
}
|
|
1581
|
+
interface PublishConfluenceArgs {
|
|
1582
|
+
/** ADF document JSON string (the `{ version, type: "doc", content }` envelope) */
|
|
1583
|
+
adf: string;
|
|
1584
|
+
/** Page ID to update (mutually exclusive with spaceId for create) */
|
|
1585
|
+
pageId?: string;
|
|
1586
|
+
/** Space ID required when creating a new page */
|
|
1587
|
+
spaceId?: string;
|
|
1588
|
+
/** Parent page ID (optional, for new pages) */
|
|
1589
|
+
parentId?: string;
|
|
1590
|
+
/** Page title. Required for create; updates existing title if provided on update */
|
|
1591
|
+
title?: string;
|
|
1592
|
+
/** Base URL of the Confluence instance, e.g. https://acme.atlassian.net/wiki */
|
|
1593
|
+
baseUrl: string;
|
|
1594
|
+
}
|
|
1595
|
+
interface PublishConfluenceDeps {
|
|
1596
|
+
auth: ConfluenceAuth;
|
|
1597
|
+
/** Defaults to globalThis.fetch */
|
|
1598
|
+
fetch?: FetchFn;
|
|
1599
|
+
}
|
|
1600
|
+
interface PublishConfluenceResult {
|
|
1601
|
+
id: string;
|
|
1602
|
+
version: number;
|
|
1603
|
+
title: string;
|
|
1604
|
+
/** Canonical URL to view the page in Confluence */
|
|
1605
|
+
url: string;
|
|
1606
|
+
action: "created" | "updated";
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Publish an ADF document to Confluence. Creates a new page if `pageId` is
|
|
1610
|
+
* omitted, otherwise updates the existing page.
|
|
1611
|
+
*/
|
|
1612
|
+
declare function publishConfluencePage(args: PublishConfluenceArgs, deps: PublishConfluenceDeps): Promise<PublishConfluenceResult>;
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Jira publisher.
|
|
1616
|
+
*
|
|
1617
|
+
* Pushes an ADF JSON document to a Jira Cloud issue via the REST API v3.
|
|
1618
|
+
* - mode "comment" adds the ADF as a new comment (default, non-destructive)
|
|
1619
|
+
* - mode "description" replaces the issue description field with the ADF
|
|
1620
|
+
*
|
|
1621
|
+
* Authentication: Basic auth with an Atlassian email + API token (same token
|
|
1622
|
+
* system as Confluence — create one at id.atlassian.com).
|
|
1623
|
+
*
|
|
1624
|
+
* Note: unlike Confluence v2 (which expects the ADF as a stringified value),
|
|
1625
|
+
* Jira v3 accepts ADF as a native JSON object in the request body.
|
|
1626
|
+
*/
|
|
1627
|
+
|
|
1628
|
+
/** Reuses the same auth + fetch shape as the Confluence publisher */
|
|
1629
|
+
type JiraAuth = ConfluenceAuth;
|
|
1630
|
+
/** Update mode — default "comment" is non-destructive and append-only */
|
|
1631
|
+
type JiraPublishMode = "comment" | "description";
|
|
1632
|
+
interface PublishJiraArgs {
|
|
1633
|
+
/** ADF document JSON string (the `{ version, type: "doc", content }` envelope) */
|
|
1634
|
+
adf: string;
|
|
1635
|
+
/** Issue key, e.g. "PROJ-123" */
|
|
1636
|
+
issueKey: string;
|
|
1637
|
+
/** Base URL of the Jira instance, e.g. https://acme.atlassian.net */
|
|
1638
|
+
baseUrl: string;
|
|
1639
|
+
/** Defaults to "comment" */
|
|
1640
|
+
mode?: JiraPublishMode;
|
|
1641
|
+
}
|
|
1642
|
+
interface PublishJiraDeps {
|
|
1643
|
+
auth: JiraAuth;
|
|
1644
|
+
/** Defaults to globalThis.fetch */
|
|
1645
|
+
fetch?: FetchFn;
|
|
1646
|
+
}
|
|
1647
|
+
interface PublishJiraResult {
|
|
1648
|
+
issueKey: string;
|
|
1649
|
+
action: "description-updated" | "comment-added";
|
|
1650
|
+
/** Canonical URL to view the issue (and comment, if applicable) */
|
|
1651
|
+
url: string;
|
|
1652
|
+
/** Set only when mode = "comment" */
|
|
1653
|
+
commentId?: string;
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Publish an ADF document to a Jira issue. Defaults to adding a new comment.
|
|
1657
|
+
* Use mode: "description" to replace the issue's description field.
|
|
1658
|
+
*/
|
|
1659
|
+
declare function publishJiraIssue(args: PublishJiraArgs, deps: PublishJiraDeps): Promise<PublishJiraResult>;
|
|
1660
|
+
|
|
1455
1661
|
interface AstroAssetResult {
|
|
1456
1662
|
markdown: string;
|
|
1457
1663
|
copiedCount: number;
|
|
@@ -2227,7 +2433,7 @@ declare function hasSufficientHistory(entries: unknown[], min: number): boolean;
|
|
|
2227
2433
|
|
|
2228
2434
|
interface ListScenariosArgs {
|
|
2229
2435
|
testCases: TestCaseResult[];
|
|
2230
|
-
format: "text" | "json";
|
|
2436
|
+
format: "text" | "json" | "csv" | "markdown-table";
|
|
2231
2437
|
}
|
|
2232
2438
|
type ListScenariosDeps = Record<string, never>;
|
|
2233
2439
|
declare function listScenarios(args: ListScenariosArgs, _deps: ListScenariosDeps): string;
|
|
@@ -2355,4 +2561,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
|
|
|
2355
2561
|
*/
|
|
2356
2562
|
declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
|
|
2357
2563
|
|
|
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 };
|
|
2564
|
+
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 ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type ExecutableStoriesConfig, type FetchFn, 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 JiraAuth, type JiraPublishMode, 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, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, 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, publishConfluencePage, publishJiraIssue, 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
|
@@ -172,6 +172,79 @@ interface WebhookPayload {
|
|
|
172
172
|
summary: NotificationSummary;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Confluence (ADF) Formatter — Layer 3.
|
|
177
|
+
*
|
|
178
|
+
* Emits Atlassian Document Format JSON. Suitable for Confluence pages
|
|
179
|
+
* and Jira issue descriptions via the REST API. Built directly from
|
|
180
|
+
* TestRunResult so code blocks, tables, links, and mermaid all round-trip
|
|
181
|
+
* with higher fidelity than converting markdown → ADF.
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
/** Options for ConfluenceFormatter */
|
|
185
|
+
interface ConfluenceFormatterOptions {
|
|
186
|
+
/** Page title. Default: "User Stories" */
|
|
187
|
+
title?: string;
|
|
188
|
+
/** Include status icons (emoji) in scenario headings. Default: true */
|
|
189
|
+
includeStatusIcons?: boolean;
|
|
190
|
+
/** Include metadata table (date, version). Default: true */
|
|
191
|
+
includeMetadata?: boolean;
|
|
192
|
+
/** Include summary table (counts, duration). Default: true */
|
|
193
|
+
includeSummaryTable?: boolean;
|
|
194
|
+
/** Include error details for failed scenarios. Default: true */
|
|
195
|
+
includeErrors?: boolean;
|
|
196
|
+
/** Scenario heading level (1-6). Default: 3 */
|
|
197
|
+
scenarioHeadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
198
|
+
/** Group scenarios by. Default: "file" */
|
|
199
|
+
groupBy?: "file" | "suite" | "none";
|
|
200
|
+
/** Sort scenarios. Default: "source" */
|
|
201
|
+
sortScenarios?: "alpha" | "source" | "none";
|
|
202
|
+
/** Pretty-print JSON output. Default: true */
|
|
203
|
+
pretty?: boolean;
|
|
204
|
+
/** Base URL for source permalinks (Git). Rendered as link marks */
|
|
205
|
+
permalinkBaseUrl?: string;
|
|
206
|
+
/** URL template for ticket links. Use {ticket} as placeholder */
|
|
207
|
+
ticketUrlTemplate?: string;
|
|
208
|
+
}
|
|
209
|
+
interface AdfMark {
|
|
210
|
+
type: string;
|
|
211
|
+
attrs?: Record<string, unknown>;
|
|
212
|
+
}
|
|
213
|
+
interface AdfNode {
|
|
214
|
+
type: string;
|
|
215
|
+
attrs?: Record<string, unknown>;
|
|
216
|
+
content?: AdfNode[];
|
|
217
|
+
marks?: AdfMark[];
|
|
218
|
+
text?: string;
|
|
219
|
+
/** Only on the root doc node */
|
|
220
|
+
version?: number;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Confluence / Atlassian Document Format formatter.
|
|
224
|
+
*
|
|
225
|
+
* Emits a top-level `{ version: 1, type: "doc", content: [...] }` tree that
|
|
226
|
+
* can be posted to the Confluence or Jira REST API.
|
|
227
|
+
*/
|
|
228
|
+
declare class ConfluenceFormatter {
|
|
229
|
+
private options;
|
|
230
|
+
constructor(options?: ConfluenceFormatterOptions);
|
|
231
|
+
/** Build the ADF document tree. Returns the JS object (not stringified). */
|
|
232
|
+
formatToAdf(run: TestRunResult): AdfNode;
|
|
233
|
+
/** Format a test run as an ADF JSON string. */
|
|
234
|
+
format(run: TestRunResult): string;
|
|
235
|
+
private renderMetadataTable;
|
|
236
|
+
private renderSummaryTable;
|
|
237
|
+
private renderByFile;
|
|
238
|
+
private renderBySuite;
|
|
239
|
+
private renderFlat;
|
|
240
|
+
private renderSuiteGroups;
|
|
241
|
+
private renderScenario;
|
|
242
|
+
private renderStepsList;
|
|
243
|
+
private renderDocEntry;
|
|
244
|
+
private sortCases;
|
|
245
|
+
private sortSuiteGroups;
|
|
246
|
+
}
|
|
247
|
+
|
|
175
248
|
/**
|
|
176
249
|
* Configuration options for ACL and formatters.
|
|
177
250
|
*/
|
|
@@ -200,7 +273,7 @@ interface CanonicalizeOptions {
|
|
|
200
273
|
};
|
|
201
274
|
}
|
|
202
275
|
/** Output format for report generation */
|
|
203
|
-
type OutputFormat = "astro" | "cucumber-json" | "cucumber-messages" | "cucumber-html" | "html" | "junit" | "markdown";
|
|
276
|
+
type OutputFormat = "astro" | "confluence" | "cucumber-json" | "cucumber-messages" | "cucumber-html" | "html" | "junit" | "markdown";
|
|
204
277
|
/** Sort order for test cases in reports (deterministic for diff-friendly output) */
|
|
205
278
|
type SortTestCasesMode = "id" | "source" | "none";
|
|
206
279
|
/** Output mode for report routing */
|
|
@@ -320,6 +393,8 @@ interface FormatterOptions {
|
|
|
320
393
|
markdown?: MarkdownFormatterOptions;
|
|
321
394
|
/** Astro/Starlight specific options */
|
|
322
395
|
astro?: AstroFormatterOptions$1;
|
|
396
|
+
/** Confluence/ADF specific options */
|
|
397
|
+
confluence?: ConfluenceFormatterOptions;
|
|
323
398
|
/** History tracking options */
|
|
324
399
|
history?: {
|
|
325
400
|
/** Path to JSON history file (enables tracking) */
|
|
@@ -473,6 +548,19 @@ interface ResolvedFormatterOptions {
|
|
|
473
548
|
includeSourceLinks: boolean;
|
|
474
549
|
customRenderers?: MarkdownRenderers;
|
|
475
550
|
};
|
|
551
|
+
confluence: {
|
|
552
|
+
title: string;
|
|
553
|
+
includeStatusIcons: boolean;
|
|
554
|
+
includeMetadata: boolean;
|
|
555
|
+
includeSummaryTable: boolean;
|
|
556
|
+
includeErrors: boolean;
|
|
557
|
+
scenarioHeadingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
558
|
+
groupBy: "file" | "suite" | "none";
|
|
559
|
+
sortScenarios: "alpha" | "source" | "none";
|
|
560
|
+
pretty: boolean;
|
|
561
|
+
permalinkBaseUrl?: string;
|
|
562
|
+
ticketUrlTemplate?: string;
|
|
563
|
+
};
|
|
476
564
|
astro: {
|
|
477
565
|
assetsDir: string;
|
|
478
566
|
assetsBaseUrl: string;
|
|
@@ -661,6 +749,15 @@ interface IJsonFeature {
|
|
|
661
749
|
uri: string;
|
|
662
750
|
}
|
|
663
751
|
|
|
752
|
+
interface Formatter {
|
|
753
|
+
name: string;
|
|
754
|
+
fileExtension?: string;
|
|
755
|
+
format(run: TestRunResult): string;
|
|
756
|
+
}
|
|
757
|
+
interface ExecutableStoriesConfig {
|
|
758
|
+
formatters?: Record<string, Formatter>;
|
|
759
|
+
}
|
|
760
|
+
|
|
664
761
|
/**
|
|
665
762
|
* Render an OTel trace waterfall (fn(args, deps)).
|
|
666
763
|
*/
|
|
@@ -1429,10 +1526,11 @@ declare class MarkdownFormatter {
|
|
|
1429
1526
|
}
|
|
1430
1527
|
|
|
1431
1528
|
/**
|
|
1432
|
-
* Astro
|
|
1529
|
+
* Astro Formatter - Layer 3.
|
|
1433
1530
|
*
|
|
1434
|
-
* Wraps the MarkdownFormatter to produce
|
|
1435
|
-
*
|
|
1531
|
+
* Wraps the MarkdownFormatter to produce .md files with YAML frontmatter
|
|
1532
|
+
* (title, description, sidebar.badge) for Starlight content collections.
|
|
1533
|
+
* The scaffolded docs site uses themed CSS matching the HTML report design system.
|
|
1436
1534
|
*/
|
|
1437
1535
|
|
|
1438
1536
|
interface StarlightBadge {
|
|
@@ -1452,6 +1550,114 @@ declare class AstroFormatter {
|
|
|
1452
1550
|
static computeBadge(testCases: Pick<TestCaseResult, "status">[]): StarlightBadge;
|
|
1453
1551
|
}
|
|
1454
1552
|
|
|
1553
|
+
/**
|
|
1554
|
+
* Confluence publisher.
|
|
1555
|
+
*
|
|
1556
|
+
* Pushes an ADF JSON document to a Confluence Cloud page via the REST API v2.
|
|
1557
|
+
* - If `pageId` is provided, the page is updated in place (title + body + version).
|
|
1558
|
+
* - If `spaceId` is provided instead, a new page is created (optionally under `parentId`).
|
|
1559
|
+
*
|
|
1560
|
+
* Authentication: Basic auth with an Atlassian email + API token.
|
|
1561
|
+
* Generate tokens at https://id.atlassian.com/manage-profile/security/api-tokens.
|
|
1562
|
+
*/
|
|
1563
|
+
/** HTTP fetch function (injectable for tests). Matches global fetch signature. */
|
|
1564
|
+
type FetchFn = (url: string, init: {
|
|
1565
|
+
method: string;
|
|
1566
|
+
headers: Record<string, string>;
|
|
1567
|
+
body?: string;
|
|
1568
|
+
}) => Promise<{
|
|
1569
|
+
ok: boolean;
|
|
1570
|
+
status: number;
|
|
1571
|
+
statusText: string;
|
|
1572
|
+
text(): Promise<string>;
|
|
1573
|
+
json(): Promise<unknown>;
|
|
1574
|
+
}>;
|
|
1575
|
+
interface ConfluenceAuth {
|
|
1576
|
+
/** Atlassian account email */
|
|
1577
|
+
email: string;
|
|
1578
|
+
/** Atlassian API token */
|
|
1579
|
+
token: string;
|
|
1580
|
+
}
|
|
1581
|
+
interface PublishConfluenceArgs {
|
|
1582
|
+
/** ADF document JSON string (the `{ version, type: "doc", content }` envelope) */
|
|
1583
|
+
adf: string;
|
|
1584
|
+
/** Page ID to update (mutually exclusive with spaceId for create) */
|
|
1585
|
+
pageId?: string;
|
|
1586
|
+
/** Space ID required when creating a new page */
|
|
1587
|
+
spaceId?: string;
|
|
1588
|
+
/** Parent page ID (optional, for new pages) */
|
|
1589
|
+
parentId?: string;
|
|
1590
|
+
/** Page title. Required for create; updates existing title if provided on update */
|
|
1591
|
+
title?: string;
|
|
1592
|
+
/** Base URL of the Confluence instance, e.g. https://acme.atlassian.net/wiki */
|
|
1593
|
+
baseUrl: string;
|
|
1594
|
+
}
|
|
1595
|
+
interface PublishConfluenceDeps {
|
|
1596
|
+
auth: ConfluenceAuth;
|
|
1597
|
+
/** Defaults to globalThis.fetch */
|
|
1598
|
+
fetch?: FetchFn;
|
|
1599
|
+
}
|
|
1600
|
+
interface PublishConfluenceResult {
|
|
1601
|
+
id: string;
|
|
1602
|
+
version: number;
|
|
1603
|
+
title: string;
|
|
1604
|
+
/** Canonical URL to view the page in Confluence */
|
|
1605
|
+
url: string;
|
|
1606
|
+
action: "created" | "updated";
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Publish an ADF document to Confluence. Creates a new page if `pageId` is
|
|
1610
|
+
* omitted, otherwise updates the existing page.
|
|
1611
|
+
*/
|
|
1612
|
+
declare function publishConfluencePage(args: PublishConfluenceArgs, deps: PublishConfluenceDeps): Promise<PublishConfluenceResult>;
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Jira publisher.
|
|
1616
|
+
*
|
|
1617
|
+
* Pushes an ADF JSON document to a Jira Cloud issue via the REST API v3.
|
|
1618
|
+
* - mode "comment" adds the ADF as a new comment (default, non-destructive)
|
|
1619
|
+
* - mode "description" replaces the issue description field with the ADF
|
|
1620
|
+
*
|
|
1621
|
+
* Authentication: Basic auth with an Atlassian email + API token (same token
|
|
1622
|
+
* system as Confluence — create one at id.atlassian.com).
|
|
1623
|
+
*
|
|
1624
|
+
* Note: unlike Confluence v2 (which expects the ADF as a stringified value),
|
|
1625
|
+
* Jira v3 accepts ADF as a native JSON object in the request body.
|
|
1626
|
+
*/
|
|
1627
|
+
|
|
1628
|
+
/** Reuses the same auth + fetch shape as the Confluence publisher */
|
|
1629
|
+
type JiraAuth = ConfluenceAuth;
|
|
1630
|
+
/** Update mode — default "comment" is non-destructive and append-only */
|
|
1631
|
+
type JiraPublishMode = "comment" | "description";
|
|
1632
|
+
interface PublishJiraArgs {
|
|
1633
|
+
/** ADF document JSON string (the `{ version, type: "doc", content }` envelope) */
|
|
1634
|
+
adf: string;
|
|
1635
|
+
/** Issue key, e.g. "PROJ-123" */
|
|
1636
|
+
issueKey: string;
|
|
1637
|
+
/** Base URL of the Jira instance, e.g. https://acme.atlassian.net */
|
|
1638
|
+
baseUrl: string;
|
|
1639
|
+
/** Defaults to "comment" */
|
|
1640
|
+
mode?: JiraPublishMode;
|
|
1641
|
+
}
|
|
1642
|
+
interface PublishJiraDeps {
|
|
1643
|
+
auth: JiraAuth;
|
|
1644
|
+
/** Defaults to globalThis.fetch */
|
|
1645
|
+
fetch?: FetchFn;
|
|
1646
|
+
}
|
|
1647
|
+
interface PublishJiraResult {
|
|
1648
|
+
issueKey: string;
|
|
1649
|
+
action: "description-updated" | "comment-added";
|
|
1650
|
+
/** Canonical URL to view the issue (and comment, if applicable) */
|
|
1651
|
+
url: string;
|
|
1652
|
+
/** Set only when mode = "comment" */
|
|
1653
|
+
commentId?: string;
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Publish an ADF document to a Jira issue. Defaults to adding a new comment.
|
|
1657
|
+
* Use mode: "description" to replace the issue's description field.
|
|
1658
|
+
*/
|
|
1659
|
+
declare function publishJiraIssue(args: PublishJiraArgs, deps: PublishJiraDeps): Promise<PublishJiraResult>;
|
|
1660
|
+
|
|
1455
1661
|
interface AstroAssetResult {
|
|
1456
1662
|
markdown: string;
|
|
1457
1663
|
copiedCount: number;
|
|
@@ -2227,7 +2433,7 @@ declare function hasSufficientHistory(entries: unknown[], min: number): boolean;
|
|
|
2227
2433
|
|
|
2228
2434
|
interface ListScenariosArgs {
|
|
2229
2435
|
testCases: TestCaseResult[];
|
|
2230
|
-
format: "text" | "json";
|
|
2436
|
+
format: "text" | "json" | "csv" | "markdown-table";
|
|
2231
2437
|
}
|
|
2232
2438
|
type ListScenariosDeps = Record<string, never>;
|
|
2233
2439
|
declare function listScenarios(args: ListScenariosArgs, _deps: ListScenariosDeps): string;
|
|
@@ -2355,4 +2561,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
|
|
|
2355
2561
|
*/
|
|
2356
2562
|
declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
|
|
2357
2563
|
|
|
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 };
|
|
2564
|
+
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 ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type ExecutableStoriesConfig, type FetchFn, 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 JiraAuth, type JiraPublishMode, 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, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, 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, publishConfluencePage, publishJiraIssue, readBranchName, readGitSha, readPackageVersion, resolveAttachment, resolveAttachments, resolveTheme, resolveTraceUrl, rewriteAssetPaths, saveHistory, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, signBody, slugify, stripAnsi, tryGetActiveOtelContext, updateHistory, validateCanonicalRun };
|