executable-stories-formatters 0.2.0 → 0.4.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
@@ -1,5 +1,5 @@
1
- import { S as StoryMeta, a as StoryStep, D as DocEntry, R as RawStatus, b as RawAttachment, c as RawRun, d as RawCIInfo, e as adaptJestRun, f as adaptPlaywrightRun, g as adaptVitestRun } from './index-DCJ0NvAp.cjs';
2
- export { h as DocPhase, J as JestAdapterOptions, i as JestAggregatedResult, j as JestFileResult, k as JestTestResult, P as PlaywrightAdapterOptions, l as PlaywrightAnnotation, m as PlaywrightAttachment, n as PlaywrightError, o as PlaywrightLocation, p as PlaywrightStatus, q as PlaywrightTestCase, r as PlaywrightTestResult, s as RawStepEvent, t as RawTestCase, u as STORY_META_KEY, v as StepKeyword, w as StepMode, x as StoryFileReport, V as VitestAdapterOptions, y as VitestSerializedError, z as VitestState, A as VitestTestCase, B as VitestTestModule, C as VitestTestResult } from './index-DCJ0NvAp.cjs';
1
+ import { S as StoryMeta, a as StoryStep, D as DocEntry, R as RawStatus, b as RawAttachment, c as RawRun, d as RawCIInfo, e as adaptJestRun, f as adaptPlaywrightRun, g as adaptVitestRun } from './index-DyeUWfYK.cjs';
2
+ export { h as DocPhase, J as JestAdapterOptions, i as JestAggregatedResult, j as JestFileResult, k as JestTestResult, O as OtelAttributeValue, l as OtelSpan, P as PlaywrightAdapterOptions, m as PlaywrightAnnotation, n as PlaywrightAttachment, o as PlaywrightError, p as PlaywrightLocation, q as PlaywrightStatus, r as PlaywrightTestCase, s as PlaywrightTestResult, t as RawStepEvent, u as RawTestCase, v as STORY_META_KEY, w as StepKeyword, x as StepMode, y as StoryFileReport, V as VitestAdapterOptions, z as VitestSerializedError, A as VitestState, B as VitestTestCase, C as VitestTestModule, E as VitestTestResult } from './index-DyeUWfYK.cjs';
3
3
 
4
4
  /**
5
5
  * Canonical types for Layer 2: Anti-Corruption Layer output.
@@ -280,6 +280,8 @@ interface MarkdownFormatterOptions {
280
280
  permalinkBaseUrl?: string;
281
281
  /** URL template for ticket links. Use {ticket} as placeholder. E.g., "https://jira.example.com/browse/{ticket}" */
282
282
  ticketUrlTemplate?: string;
283
+ /** URL template for trace links. Use {traceId} as placeholder. E.g., "https://grafana.example.com/explore?traceId={traceId}" */
284
+ traceUrlTemplate?: string;
283
285
  /** Include source links when permalinkBaseUrl is set. Default: true */
284
286
  includeSourceLinks?: boolean;
285
287
  /** Custom renderers for doc entries */
@@ -350,6 +352,7 @@ interface ResolvedFormatterOptions {
350
352
  includeSummaryTable: boolean;
351
353
  permalinkBaseUrl?: string;
352
354
  ticketUrlTemplate?: string;
355
+ traceUrlTemplate?: string;
353
356
  includeSourceLinks: boolean;
354
357
  customRenderers?: MarkdownRenderers;
355
358
  };
@@ -871,6 +874,8 @@ interface MarkdownOptions {
871
874
  permalinkBaseUrl?: string;
872
875
  /** URL template for ticket links. Use {ticket} as placeholder */
873
876
  ticketUrlTemplate?: string;
877
+ /** URL template for trace links. Use {traceId} as placeholder. E.g. "https://grafana.example.com/explore?traceId={traceId}" */
878
+ traceUrlTemplate?: string;
874
879
  /** Include source links when permalinkBaseUrl is set. Default: true */
875
880
  includeSourceLinks?: boolean;
876
881
  /** Custom renderers for doc entries */
@@ -1376,6 +1381,27 @@ declare function clearVersionCache(): void;
1376
1381
  */
1377
1382
  declare function detectCI(env?: Record<string, string | undefined>): RawCIInfo | undefined;
1378
1383
 
1384
+ /**
1385
+ * OTel trace context detection.
1386
+ *
1387
+ * Detects an active OpenTelemetry span via `@opentelemetry/api` (optional peer).
1388
+ * Uses `createRequire` so the import is lazy and never breaks if OTel isn't installed.
1389
+ */
1390
+ interface OtelTraceContext {
1391
+ traceId: string;
1392
+ spanId: string;
1393
+ }
1394
+ /**
1395
+ * Try to read trace context from the currently-active OTel span.
1396
+ * Returns `undefined` when `@opentelemetry/api` is not installed or no span is active.
1397
+ */
1398
+ declare function tryGetActiveOtelContext(): OtelTraceContext | undefined;
1399
+ /**
1400
+ * Replace `{traceId}` in a URL template.
1401
+ * Returns `undefined` when no template is provided.
1402
+ */
1403
+ declare function resolveTraceUrl(template: string | undefined, traceId: string): string | undefined;
1404
+
1379
1405
  /**
1380
1406
  * @executable-stories/formatters
1381
1407
  *
@@ -1465,4 +1491,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
1465
1491
  */
1466
1492
  declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
1467
1493
 
1468
- export { type Attachment, type CIInfo, type CanonicalizeOptions, type ColocatedStyle, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type FormatterOptions, type GenerateArgs, type GenerateDeps, type GenerateResult, HtmlFormatter, type HtmlOptions, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type Logger, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, RawAttachment, RawCIInfo, RawRun, RawStatus, ReportGenerator, type ResolvedFormatterOptions, type StepResult, StoryMeta, StoryStep, type TestCaseAttempt, type TestCaseResult, type TestRunResult, type TestStatus, type ValidationResult, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, canonicalizeRun, clearVersionCache, createReportGenerator, deriveStepResults, detectCI, findGitDir, formatDuration, generateRunId, generateTestCaseId, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, readBranchName, readGitSha, readPackageVersion, resolveAttachment, resolveAttachments, slugify, validateCanonicalRun };
1494
+ export { type Attachment, type CIInfo, type CanonicalizeOptions, type ColocatedStyle, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type FormatterOptions, type GenerateArgs, type GenerateDeps, type GenerateResult, HtmlFormatter, type HtmlOptions, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type Logger, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, RawAttachment, RawCIInfo, RawRun, RawStatus, ReportGenerator, type ResolvedFormatterOptions, type StepResult, StoryMeta, StoryStep, type TestCaseAttempt, type TestCaseResult, type TestRunResult, type TestStatus, type ValidationResult, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, canonicalizeRun, clearVersionCache, createReportGenerator, deriveStepResults, detectCI, findGitDir, formatDuration, generateRunId, generateTestCaseId, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, readBranchName, readGitSha, readPackageVersion, resolveAttachment, resolveAttachments, resolveTraceUrl, slugify, tryGetActiveOtelContext, validateCanonicalRun };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as StoryMeta, a as StoryStep, D as DocEntry, R as RawStatus, b as RawAttachment, c as RawRun, d as RawCIInfo, e as adaptJestRun, f as adaptPlaywrightRun, g as adaptVitestRun } from './index-DCJ0NvAp.js';
2
- export { h as DocPhase, J as JestAdapterOptions, i as JestAggregatedResult, j as JestFileResult, k as JestTestResult, P as PlaywrightAdapterOptions, l as PlaywrightAnnotation, m as PlaywrightAttachment, n as PlaywrightError, o as PlaywrightLocation, p as PlaywrightStatus, q as PlaywrightTestCase, r as PlaywrightTestResult, s as RawStepEvent, t as RawTestCase, u as STORY_META_KEY, v as StepKeyword, w as StepMode, x as StoryFileReport, V as VitestAdapterOptions, y as VitestSerializedError, z as VitestState, A as VitestTestCase, B as VitestTestModule, C as VitestTestResult } from './index-DCJ0NvAp.js';
1
+ import { S as StoryMeta, a as StoryStep, D as DocEntry, R as RawStatus, b as RawAttachment, c as RawRun, d as RawCIInfo, e as adaptJestRun, f as adaptPlaywrightRun, g as adaptVitestRun } from './index-DyeUWfYK.js';
2
+ export { h as DocPhase, J as JestAdapterOptions, i as JestAggregatedResult, j as JestFileResult, k as JestTestResult, O as OtelAttributeValue, l as OtelSpan, P as PlaywrightAdapterOptions, m as PlaywrightAnnotation, n as PlaywrightAttachment, o as PlaywrightError, p as PlaywrightLocation, q as PlaywrightStatus, r as PlaywrightTestCase, s as PlaywrightTestResult, t as RawStepEvent, u as RawTestCase, v as STORY_META_KEY, w as StepKeyword, x as StepMode, y as StoryFileReport, V as VitestAdapterOptions, z as VitestSerializedError, A as VitestState, B as VitestTestCase, C as VitestTestModule, E as VitestTestResult } from './index-DyeUWfYK.js';
3
3
 
4
4
  /**
5
5
  * Canonical types for Layer 2: Anti-Corruption Layer output.
@@ -280,6 +280,8 @@ interface MarkdownFormatterOptions {
280
280
  permalinkBaseUrl?: string;
281
281
  /** URL template for ticket links. Use {ticket} as placeholder. E.g., "https://jira.example.com/browse/{ticket}" */
282
282
  ticketUrlTemplate?: string;
283
+ /** URL template for trace links. Use {traceId} as placeholder. E.g., "https://grafana.example.com/explore?traceId={traceId}" */
284
+ traceUrlTemplate?: string;
283
285
  /** Include source links when permalinkBaseUrl is set. Default: true */
284
286
  includeSourceLinks?: boolean;
285
287
  /** Custom renderers for doc entries */
@@ -350,6 +352,7 @@ interface ResolvedFormatterOptions {
350
352
  includeSummaryTable: boolean;
351
353
  permalinkBaseUrl?: string;
352
354
  ticketUrlTemplate?: string;
355
+ traceUrlTemplate?: string;
353
356
  includeSourceLinks: boolean;
354
357
  customRenderers?: MarkdownRenderers;
355
358
  };
@@ -871,6 +874,8 @@ interface MarkdownOptions {
871
874
  permalinkBaseUrl?: string;
872
875
  /** URL template for ticket links. Use {ticket} as placeholder */
873
876
  ticketUrlTemplate?: string;
877
+ /** URL template for trace links. Use {traceId} as placeholder. E.g. "https://grafana.example.com/explore?traceId={traceId}" */
878
+ traceUrlTemplate?: string;
874
879
  /** Include source links when permalinkBaseUrl is set. Default: true */
875
880
  includeSourceLinks?: boolean;
876
881
  /** Custom renderers for doc entries */
@@ -1376,6 +1381,27 @@ declare function clearVersionCache(): void;
1376
1381
  */
1377
1382
  declare function detectCI(env?: Record<string, string | undefined>): RawCIInfo | undefined;
1378
1383
 
1384
+ /**
1385
+ * OTel trace context detection.
1386
+ *
1387
+ * Detects an active OpenTelemetry span via `@opentelemetry/api` (optional peer).
1388
+ * Uses `createRequire` so the import is lazy and never breaks if OTel isn't installed.
1389
+ */
1390
+ interface OtelTraceContext {
1391
+ traceId: string;
1392
+ spanId: string;
1393
+ }
1394
+ /**
1395
+ * Try to read trace context from the currently-active OTel span.
1396
+ * Returns `undefined` when `@opentelemetry/api` is not installed or no span is active.
1397
+ */
1398
+ declare function tryGetActiveOtelContext(): OtelTraceContext | undefined;
1399
+ /**
1400
+ * Replace `{traceId}` in a URL template.
1401
+ * Returns `undefined` when no template is provided.
1402
+ */
1403
+ declare function resolveTraceUrl(template: string | undefined, traceId: string): string | undefined;
1404
+
1379
1405
  /**
1380
1406
  * @executable-stories/formatters
1381
1407
  *
@@ -1465,4 +1491,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
1465
1491
  */
1466
1492
  declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
1467
1493
 
1468
- export { type Attachment, type CIInfo, type CanonicalizeOptions, type ColocatedStyle, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type FormatterOptions, type GenerateArgs, type GenerateDeps, type GenerateResult, HtmlFormatter, type HtmlOptions, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type Logger, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, RawAttachment, RawCIInfo, RawRun, RawStatus, ReportGenerator, type ResolvedFormatterOptions, type StepResult, StoryMeta, StoryStep, type TestCaseAttempt, type TestCaseResult, type TestRunResult, type TestStatus, type ValidationResult, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, canonicalizeRun, clearVersionCache, createReportGenerator, deriveStepResults, detectCI, findGitDir, formatDuration, generateRunId, generateTestCaseId, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, readBranchName, readGitSha, readPackageVersion, resolveAttachment, resolveAttachments, slugify, validateCanonicalRun };
1494
+ export { type Attachment, type CIInfo, type CanonicalizeOptions, type ColocatedStyle, type CoverageSummary, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, DocEntry, type FormatterOptions, type GenerateArgs, type GenerateDeps, type GenerateResult, HtmlFormatter, type HtmlOptions, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type Logger, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, RawAttachment, RawCIInfo, RawRun, RawStatus, ReportGenerator, type ResolvedFormatterOptions, type StepResult, StoryMeta, StoryStep, type TestCaseAttempt, type TestCaseResult, type TestRunResult, type TestStatus, type ValidationResult, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, canonicalizeRun, clearVersionCache, createReportGenerator, deriveStepResults, detectCI, findGitDir, formatDuration, generateRunId, generateTestCaseId, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, readBranchName, readGitSha, readPackageVersion, resolveAttachment, resolveAttachments, resolveTraceUrl, slugify, tryGetActiveOtelContext, validateCanonicalRun };