executable-stories-formatters 1.17.0 → 1.17.1

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
@@ -371,7 +371,7 @@ interface FormatterOptions {
371
371
  /** Generic webhook configurations */
372
372
  webhooks?: GenericWebhookNotifierOptions[];
373
373
  };
374
- /** Asset bundling mode. "none" = no asset copying, "copy" = copy referenced assets next to HTML. Default: "none" */
374
+ /** Asset bundling mode. "none" = no asset copying, "copy" = copy referenced assets next to the report (html and markdown). Default: "none" */
375
375
  assetMode?: "none" | "copy";
376
376
  /** When true, warn on missing assets instead of throwing. Default: false */
377
377
  allowMissingAssets?: boolean;
@@ -3130,6 +3130,12 @@ declare class ReportGenerator {
3130
3130
  * @returns Map of output format to generated file paths
3131
3131
  */
3132
3132
  generate(run: TestRunResult, options?: GenerateOptions): Promise<GenerateResult>;
3133
+ /**
3134
+ * Copy every local asset these markdown reports reference into an assets
3135
+ * directory and rewrite the refs. The destination is computed per report
3136
+ * because colocated output writes one per source file.
3137
+ */
3138
+ private bundleMarkdownAssets;
3133
3139
  /**
3134
3140
  * Whether any output is colocated — the global mode, or any per-rule mode.
3135
3141
  * A colocated rule under a global aggregated mode still writes per-file
package/dist/index.d.ts CHANGED
@@ -371,7 +371,7 @@ interface FormatterOptions {
371
371
  /** Generic webhook configurations */
372
372
  webhooks?: GenericWebhookNotifierOptions[];
373
373
  };
374
- /** Asset bundling mode. "none" = no asset copying, "copy" = copy referenced assets next to HTML. Default: "none" */
374
+ /** Asset bundling mode. "none" = no asset copying, "copy" = copy referenced assets next to the report (html and markdown). Default: "none" */
375
375
  assetMode?: "none" | "copy";
376
376
  /** When true, warn on missing assets instead of throwing. Default: false */
377
377
  allowMissingAssets?: boolean;
@@ -3130,6 +3130,12 @@ declare class ReportGenerator {
3130
3130
  * @returns Map of output format to generated file paths
3131
3131
  */
3132
3132
  generate(run: TestRunResult, options?: GenerateOptions): Promise<GenerateResult>;
3133
+ /**
3134
+ * Copy every local asset these markdown reports reference into an assets
3135
+ * directory and rewrite the refs. The destination is computed per report
3136
+ * because colocated output writes one per source file.
3137
+ */
3138
+ private bundleMarkdownAssets;
3133
3139
  /**
3134
3140
  * Whether any output is colocated — the global mode, or any per-rule mode.
3135
3141
  * A colocated rule under a global aggregated mode still writes per-file
package/dist/index.js CHANGED
@@ -7568,27 +7568,39 @@ var ReportGenerator = class {
7568
7568
  bundleAssets(htmlPath, { allowMissing: this.options.allowMissingAssets });
7569
7569
  }
7570
7570
  }
7571
- const astroPaths = results.get("astro-markdown");
7572
- if (astroPaths) {
7573
- for (const mdPath of astroPaths) {
7574
- const content = await fsPromises2.readFile(mdPath, "utf8");
7575
- const mdDir = path7.dirname(mdPath);
7576
- const assetsDir = path7.resolve(this.options.astro.assetsDir);
7577
- const result = copyMarkdownAssets({
7578
- markdown: content,
7579
- markdownDir: mdDir,
7580
- assetsDir,
7581
- assetsBaseUrl: this.options.astro.assetsBaseUrl,
7582
- allowMissing: this.options.allowMissingAssets
7583
- });
7584
- if (result.copiedCount > 0 || result.missingCount > 0) {
7585
- await this.deps.writeFile(mdPath, result.markdown);
7586
- }
7587
- }
7588
- }
7571
+ await this.bundleMarkdownAssets(results.get("markdown"), (markdownDir) => ({
7572
+ assetsDir: path7.join(markdownDir, "assets"),
7573
+ assetsBaseUrl: "assets"
7574
+ }));
7575
+ await this.bundleMarkdownAssets(results.get("astro-markdown"), () => ({
7576
+ // assetsDir is resolved from CWD (same as outputDir), not relative to outputDir
7577
+ assetsDir: path7.resolve(this.options.astro.assetsDir),
7578
+ assetsBaseUrl: this.options.astro.assetsBaseUrl
7579
+ }));
7589
7580
  }
7590
7581
  return results;
7591
7582
  }
7583
+ /**
7584
+ * Copy every local asset these markdown reports reference into an assets
7585
+ * directory and rewrite the refs. The destination is computed per report
7586
+ * because colocated output writes one per source file.
7587
+ */
7588
+ async bundleMarkdownAssets(markdownPaths, target) {
7589
+ if (!markdownPaths) return;
7590
+ for (const markdownPath of markdownPaths) {
7591
+ const markdown = await fsPromises2.readFile(markdownPath, "utf8");
7592
+ const markdownDir = path7.dirname(markdownPath);
7593
+ const result = copyMarkdownAssets({
7594
+ markdown,
7595
+ markdownDir,
7596
+ allowMissing: this.options.allowMissingAssets,
7597
+ ...target(markdownDir)
7598
+ });
7599
+ if (result.copiedCount > 0 || result.missingCount > 0) {
7600
+ await this.deps.writeFile(markdownPath, result.markdown);
7601
+ }
7602
+ }
7603
+ }
7592
7604
  /**
7593
7605
  * Whether any output is colocated — the global mode, or any per-rule mode.
7594
7606
  * A colocated rule under a global aggregated mode still writes per-file