executable-stories-formatters 0.7.10 → 0.7.12
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/cli.js +197 -104
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +166 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +165 -72
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -106,8 +106,8 @@ __export(src_exports, {
|
|
|
106
106
|
validateCanonicalRun: () => validateCanonicalRun
|
|
107
107
|
});
|
|
108
108
|
module.exports = __toCommonJS(src_exports);
|
|
109
|
-
var
|
|
110
|
-
var
|
|
109
|
+
var fs8 = require("fs");
|
|
110
|
+
var path8 = __toESM(require("path"), 1);
|
|
111
111
|
var fsPromises = __toESM(require("fs/promises"), 1);
|
|
112
112
|
|
|
113
113
|
// src/converters/acl/status.ts
|
|
@@ -760,6 +760,10 @@ ${doc.markdown}`,
|
|
|
760
760
|
}
|
|
761
761
|
};
|
|
762
762
|
|
|
763
|
+
// src/formatters/html/renderers/index.ts
|
|
764
|
+
var fs2 = __toESM(require("fs"), 1);
|
|
765
|
+
var path2 = __toESM(require("path"), 1);
|
|
766
|
+
|
|
763
767
|
// src/formatters/html/template.ts
|
|
764
768
|
var JS_THEME = `
|
|
765
769
|
// Theme management
|
|
@@ -2418,6 +2422,27 @@ body {
|
|
|
2418
2422
|
border: 1px solid var(--border);
|
|
2419
2423
|
}
|
|
2420
2424
|
|
|
2425
|
+
.attachment-unavailable {
|
|
2426
|
+
padding: 0.75rem 1rem;
|
|
2427
|
+
border: 1px dashed var(--border);
|
|
2428
|
+
border-radius: calc(var(--radius) - 2px);
|
|
2429
|
+
background: var(--muted, transparent);
|
|
2430
|
+
color: var(--muted-foreground);
|
|
2431
|
+
font-size: 0.8125rem;
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
.attachment-unavailable-label {
|
|
2435
|
+
font-weight: 600;
|
|
2436
|
+
margin-bottom: 0.25rem;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
.attachment-unavailable-path {
|
|
2440
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
2441
|
+
font-size: 0.75rem;
|
|
2442
|
+
word-break: break-all;
|
|
2443
|
+
opacity: 0.8;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2421
2446
|
/* ============================================================================
|
|
2422
2447
|
Chevron Icon - smooth rotation
|
|
2423
2448
|
============================================================================ */
|
|
@@ -2983,6 +3008,27 @@ body {
|
|
|
2983
3008
|
font-style: italic;
|
|
2984
3009
|
}
|
|
2985
3010
|
|
|
3011
|
+
.doc-screenshot-missing {
|
|
3012
|
+
padding: 0.75rem 1rem;
|
|
3013
|
+
border: 1px dashed var(--border);
|
|
3014
|
+
border-radius: calc(var(--radius) - 2px);
|
|
3015
|
+
background: var(--muted, transparent);
|
|
3016
|
+
color: var(--muted-foreground);
|
|
3017
|
+
font-size: 0.8125rem;
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
.doc-screenshot-missing-label {
|
|
3021
|
+
font-weight: 600;
|
|
3022
|
+
margin-bottom: 0.25rem;
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
.doc-screenshot-missing-path {
|
|
3026
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
3027
|
+
font-size: 0.75rem;
|
|
3028
|
+
word-break: break-all;
|
|
3029
|
+
opacity: 0.8;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
2986
3032
|
/* ============================================================================
|
|
2987
3033
|
Documentation Entries - Custom
|
|
2988
3034
|
============================================================================ */
|
|
@@ -12960,11 +13006,18 @@ function renderTagBar(args, deps) {
|
|
|
12960
13006
|
</div>`;
|
|
12961
13007
|
}
|
|
12962
13008
|
|
|
13009
|
+
// src/notifiers/ansi-strip.ts
|
|
13010
|
+
function stripAnsi(text2) {
|
|
13011
|
+
return text2.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
|
|
13012
|
+
}
|
|
13013
|
+
|
|
12963
13014
|
// src/formatters/html/renderers/error-box.ts
|
|
12964
13015
|
function renderErrorBox(args, deps) {
|
|
12965
|
-
const
|
|
13016
|
+
const message = stripAnsi(args.message);
|
|
13017
|
+
const stack = args.stack != null ? stripAnsi(args.stack) : void 0;
|
|
13018
|
+
const body = stack != null ? `${deps.escapeHtml(message)}
|
|
12966
13019
|
|
|
12967
|
-
${deps.escapeHtml(
|
|
13020
|
+
${deps.escapeHtml(stack)}` : deps.escapeHtml(message);
|
|
12968
13021
|
return `<div class="error-box">${body}</div>`;
|
|
12969
13022
|
}
|
|
12970
13023
|
|
|
@@ -12977,6 +13030,7 @@ function renderAttachments(args, deps) {
|
|
|
12977
13030
|
const isImage = att.mediaType.startsWith("image/");
|
|
12978
13031
|
const isVideo = att.mediaType.startsWith("video/");
|
|
12979
13032
|
const isBase64 = att.contentEncoding === "BASE64";
|
|
13033
|
+
const isUnreachableFsPath = deps.embedScreenshots && !isBase64 && typeof att.body === "string" && /^(?:[/\\]|[A-Za-z]:[/\\])/.test(att.body);
|
|
12980
13034
|
if (isImage && deps.embedScreenshots && isBase64) {
|
|
12981
13035
|
return `
|
|
12982
13036
|
<div class="attachment">
|
|
@@ -12984,12 +13038,19 @@ function renderAttachments(args, deps) {
|
|
|
12984
13038
|
<img class="attachment-image" src="data:${att.mediaType};base64,${att.body}" alt="${deps.escapeHtml(att.name)}" />
|
|
12985
13039
|
</div>`;
|
|
12986
13040
|
}
|
|
12987
|
-
if (isVideo && deps.embedScreenshots) {
|
|
13041
|
+
if (isVideo && deps.embedScreenshots && !isUnreachableFsPath) {
|
|
12988
13042
|
const src = isBase64 ? `data:${att.mediaType};base64,${att.body}` : att.body;
|
|
12989
13043
|
return `
|
|
12990
13044
|
<div class="attachment">
|
|
12991
13045
|
${deps.escapeHtml(att.name)}
|
|
12992
13046
|
<video class="attachment-video" controls src="${deps.escapeHtml(src)}"></video>
|
|
13047
|
+
</div>`;
|
|
13048
|
+
}
|
|
13049
|
+
if (isUnreachableFsPath) {
|
|
13050
|
+
return `
|
|
13051
|
+
<div class="attachment attachment-unavailable">
|
|
13052
|
+
<div class="attachment-unavailable-label">${deps.escapeHtml(att.name)} unavailable</div>
|
|
13053
|
+
<div class="attachment-unavailable-path">${deps.escapeHtml(att.body)}</div>
|
|
12993
13054
|
</div>`;
|
|
12994
13055
|
}
|
|
12995
13056
|
const href = isBase64 ? `data:${att.mediaType};base64,${att.body}` : att.body;
|
|
@@ -13070,7 +13131,20 @@ function renderDocMermaid(entry, deps) {
|
|
|
13070
13131
|
}
|
|
13071
13132
|
function renderDocScreenshot(entry, deps) {
|
|
13072
13133
|
const alt = entry.alt ?? "Screenshot";
|
|
13073
|
-
const
|
|
13134
|
+
const embedEnabled = deps.embedScreenshots ?? true;
|
|
13135
|
+
const isRemote = /^(?:https?:|data:)/i.test(entry.path);
|
|
13136
|
+
const embedAttempted = !isRemote && embedEnabled && !!deps.readScreenshot;
|
|
13137
|
+
const inlined = embedAttempted ? deps.readScreenshot(entry.path) : void 0;
|
|
13138
|
+
const isAbsoluteFsPath = !isRemote && /^(?:[/\\]|[A-Za-z]:[/\\])/.test(entry.path);
|
|
13139
|
+
if (embedAttempted && inlined === void 0 && isAbsoluteFsPath) {
|
|
13140
|
+
const captionHtml = entry.alt ? `<div class="doc-screenshot-caption">${deps.escapeHtml(entry.alt)}</div>` : "";
|
|
13141
|
+
return `<div class="doc-screenshot doc-screenshot-missing">
|
|
13142
|
+
<div class="doc-screenshot-missing-label">Screenshot unavailable</div>
|
|
13143
|
+
<div class="doc-screenshot-missing-path">${deps.escapeHtml(entry.path)}</div>
|
|
13144
|
+
${captionHtml}
|
|
13145
|
+
</div>`;
|
|
13146
|
+
}
|
|
13147
|
+
const src = inlined ?? entry.path;
|
|
13074
13148
|
return `<div class="doc-screenshot">
|
|
13075
13149
|
<img src="${deps.escapeHtml(src)}" alt="${deps.escapeHtml(alt)}" class="doc-screenshot-img" />
|
|
13076
13150
|
${entry.alt ? `<div class="doc-screenshot-caption">${deps.escapeHtml(entry.alt)}</div>` : ""}
|
|
@@ -13657,6 +13731,28 @@ function renderToc(args, deps) {
|
|
|
13657
13731
|
}
|
|
13658
13732
|
|
|
13659
13733
|
// src/formatters/html/renderers/index.ts
|
|
13734
|
+
var SCREENSHOT_MIME_BY_EXT = {
|
|
13735
|
+
png: "image/png",
|
|
13736
|
+
jpg: "image/jpeg",
|
|
13737
|
+
jpeg: "image/jpeg",
|
|
13738
|
+
gif: "image/gif",
|
|
13739
|
+
webp: "image/webp",
|
|
13740
|
+
svg: "image/svg+xml",
|
|
13741
|
+
avif: "image/avif",
|
|
13742
|
+
bmp: "image/bmp"
|
|
13743
|
+
};
|
|
13744
|
+
function readScreenshotAsDataUri(filePath) {
|
|
13745
|
+
try {
|
|
13746
|
+
const ext = path2.extname(filePath).slice(1).toLowerCase();
|
|
13747
|
+
const mime = SCREENSHOT_MIME_BY_EXT[ext];
|
|
13748
|
+
if (!mime) return void 0;
|
|
13749
|
+
if (!fs2.existsSync(filePath)) return void 0;
|
|
13750
|
+
const buf = fs2.readFileSync(filePath);
|
|
13751
|
+
return `data:${mime};base64,${buf.toString("base64")}`;
|
|
13752
|
+
} catch {
|
|
13753
|
+
return void 0;
|
|
13754
|
+
}
|
|
13755
|
+
}
|
|
13660
13756
|
function normalizeOptions(options = {}) {
|
|
13661
13757
|
return {
|
|
13662
13758
|
title: options.title ?? "Test Results",
|
|
@@ -13680,7 +13776,9 @@ function createHtmlFormatter(options = {}) {
|
|
|
13680
13776
|
escapeHtml,
|
|
13681
13777
|
syntaxHighlighting: opts.syntaxHighlighting,
|
|
13682
13778
|
markdownEnabled: opts.markdownEnabled,
|
|
13683
|
-
mermaidEnabled: opts.mermaidEnabled
|
|
13779
|
+
mermaidEnabled: opts.mermaidEnabled,
|
|
13780
|
+
embedScreenshots: opts.embedScreenshots,
|
|
13781
|
+
readScreenshot: (filePath) => readScreenshotAsDataUri(filePath)
|
|
13684
13782
|
};
|
|
13685
13783
|
const renderDocs = (docs, containerClass) => {
|
|
13686
13784
|
if (!docs || docs.length === 0) return "";
|
|
@@ -15109,8 +15207,8 @@ function extractDocAttachments(step) {
|
|
|
15109
15207
|
}
|
|
15110
15208
|
return attachments;
|
|
15111
15209
|
}
|
|
15112
|
-
function guessMediaType(
|
|
15113
|
-
const lower =
|
|
15210
|
+
function guessMediaType(path9) {
|
|
15211
|
+
const lower = path9.toLowerCase();
|
|
15114
15212
|
if (lower.endsWith(".png")) return "image/png";
|
|
15115
15213
|
if (lower.endsWith(".jpg") || lower.endsWith(".jpeg")) return "image/jpeg";
|
|
15116
15214
|
if (lower.endsWith(".gif")) return "image/gif";
|
|
@@ -16154,8 +16252,8 @@ function selectTestCases(args, deps) {
|
|
|
16154
16252
|
}
|
|
16155
16253
|
|
|
16156
16254
|
// src/bundler/bundle-assets.ts
|
|
16157
|
-
var
|
|
16158
|
-
var
|
|
16255
|
+
var fs4 = __toESM(require("fs"), 1);
|
|
16256
|
+
var path4 = __toESM(require("path"), 1);
|
|
16159
16257
|
|
|
16160
16258
|
// src/bundler/scan-html-assets.ts
|
|
16161
16259
|
function scanHtmlAssets(html) {
|
|
@@ -16185,21 +16283,21 @@ function isLocalAssetRef(ref) {
|
|
|
16185
16283
|
}
|
|
16186
16284
|
|
|
16187
16285
|
// src/bundler/copy-asset.ts
|
|
16188
|
-
var
|
|
16189
|
-
var
|
|
16286
|
+
var fs3 = __toESM(require("fs"), 1);
|
|
16287
|
+
var path3 = __toESM(require("path"), 1);
|
|
16190
16288
|
var crypto = __toESM(require("crypto"), 1);
|
|
16191
16289
|
function copyAsset(sourcePath, assetsDir) {
|
|
16192
|
-
if (!
|
|
16193
|
-
|
|
16290
|
+
if (!fs3.existsSync(assetsDir)) {
|
|
16291
|
+
fs3.mkdirSync(assetsDir, { recursive: true });
|
|
16194
16292
|
}
|
|
16195
|
-
const content =
|
|
16293
|
+
const content = fs3.readFileSync(sourcePath);
|
|
16196
16294
|
const hash = crypto.createHash("sha256").update(content).digest("hex").slice(0, 8);
|
|
16197
|
-
const ext =
|
|
16198
|
-
const baseName = sanitize(
|
|
16295
|
+
const ext = path3.extname(sourcePath);
|
|
16296
|
+
const baseName = sanitize(path3.basename(sourcePath, ext));
|
|
16199
16297
|
const destName = `${baseName}-${hash}${ext}`;
|
|
16200
|
-
const destPath =
|
|
16201
|
-
if (!
|
|
16202
|
-
|
|
16298
|
+
const destPath = path3.join(assetsDir, destName);
|
|
16299
|
+
if (!fs3.existsSync(destPath)) {
|
|
16300
|
+
fs3.copyFileSync(sourcePath, destPath);
|
|
16203
16301
|
}
|
|
16204
16302
|
return `assets/${destName}`;
|
|
16205
16303
|
}
|
|
@@ -16209,15 +16307,15 @@ function sanitize(name) {
|
|
|
16209
16307
|
|
|
16210
16308
|
// src/bundler/bundle-assets.ts
|
|
16211
16309
|
function bundleAssets(htmlPath, options = {}) {
|
|
16212
|
-
const htmlDir =
|
|
16213
|
-
const assetsDir =
|
|
16214
|
-
let html =
|
|
16310
|
+
const htmlDir = path4.dirname(htmlPath);
|
|
16311
|
+
const assetsDir = path4.join(htmlDir, "assets");
|
|
16312
|
+
let html = fs4.readFileSync(htmlPath, "utf8");
|
|
16215
16313
|
const refs = scanHtmlAssets(html);
|
|
16216
16314
|
let copiedCount = 0;
|
|
16217
16315
|
const missing = [];
|
|
16218
16316
|
for (const ref of refs) {
|
|
16219
|
-
const absolutePath =
|
|
16220
|
-
if (!
|
|
16317
|
+
const absolutePath = path4.resolve(htmlDir, ref);
|
|
16318
|
+
if (!fs4.existsSync(absolutePath)) {
|
|
16221
16319
|
missing.push(ref);
|
|
16222
16320
|
continue;
|
|
16223
16321
|
}
|
|
@@ -16230,7 +16328,7 @@ function bundleAssets(htmlPath, options = {}) {
|
|
|
16230
16328
|
`Missing asset${missing.length > 1 ? "s" : ""}: ${missing.join(", ")}`
|
|
16231
16329
|
);
|
|
16232
16330
|
}
|
|
16233
|
-
|
|
16331
|
+
fs4.writeFileSync(htmlPath, html, "utf8");
|
|
16234
16332
|
return {
|
|
16235
16333
|
copiedCount,
|
|
16236
16334
|
missingCount: missing.length,
|
|
@@ -16713,15 +16811,15 @@ function groupBy7(items, keyFn) {
|
|
|
16713
16811
|
}
|
|
16714
16812
|
|
|
16715
16813
|
// src/formatters/astro-assets.ts
|
|
16716
|
-
var
|
|
16717
|
-
var
|
|
16814
|
+
var fs5 = __toESM(require("fs"), 1);
|
|
16815
|
+
var path5 = __toESM(require("path"), 1);
|
|
16718
16816
|
var SKIP_PREFIXES = ["http://", "https://", "data:", "#"];
|
|
16719
16817
|
function isLocalPath(src) {
|
|
16720
16818
|
const trimmed = src.trim();
|
|
16721
16819
|
if (SKIP_PREFIXES.some((prefix) => trimmed.startsWith(prefix))) {
|
|
16722
16820
|
return false;
|
|
16723
16821
|
}
|
|
16724
|
-
return !
|
|
16822
|
+
return !path5.posix.isAbsolute(trimmed) && !path5.win32.isAbsolute(trimmed);
|
|
16725
16823
|
}
|
|
16726
16824
|
function stripCodeContent(markdown) {
|
|
16727
16825
|
let result = markdown.replace(/^[ \t]*(`{3,}|~{3,})[^\n]*\n[\s\S]*?^[ \t]*\1\s*$/gm, "");
|
|
@@ -16815,8 +16913,8 @@ function copyMarkdownAssets(options) {
|
|
|
16815
16913
|
const pathMap = /* @__PURE__ */ new Map();
|
|
16816
16914
|
const missing = [];
|
|
16817
16915
|
for (const ref of refs) {
|
|
16818
|
-
const absPath =
|
|
16819
|
-
if (!
|
|
16916
|
+
const absPath = path5.resolve(markdownDir, ref);
|
|
16917
|
+
if (!fs5.existsSync(absPath)) {
|
|
16820
16918
|
if (!allowMissing) {
|
|
16821
16919
|
throw new Error(`Asset not found: ${absPath}`);
|
|
16822
16920
|
}
|
|
@@ -17832,27 +17930,27 @@ function pickleStepArgumentToDocs(ps) {
|
|
|
17832
17930
|
}
|
|
17833
17931
|
|
|
17834
17932
|
// src/utils/git-info.ts
|
|
17835
|
-
var
|
|
17836
|
-
var
|
|
17933
|
+
var fs6 = __toESM(require("fs"), 1);
|
|
17934
|
+
var path6 = __toESM(require("path"), 1);
|
|
17837
17935
|
function readGitSha(cwd = process.cwd()) {
|
|
17838
17936
|
const envSha = process.env.GITHUB_SHA || process.env.GIT_COMMIT || process.env.CI_COMMIT_SHA;
|
|
17839
17937
|
if (envSha) return envSha;
|
|
17840
17938
|
const gitDir = findGitDir(cwd);
|
|
17841
17939
|
if (!gitDir) return void 0;
|
|
17842
17940
|
try {
|
|
17843
|
-
const headPath =
|
|
17844
|
-
const head =
|
|
17941
|
+
const headPath = path6.join(gitDir, "HEAD");
|
|
17942
|
+
const head = fs6.readFileSync(headPath, "utf8").trim();
|
|
17845
17943
|
if (!head.startsWith("ref:")) {
|
|
17846
17944
|
return head;
|
|
17847
17945
|
}
|
|
17848
17946
|
const refPath = head.replace("ref:", "").trim();
|
|
17849
|
-
const refFile =
|
|
17850
|
-
if (
|
|
17851
|
-
return
|
|
17947
|
+
const refFile = path6.join(gitDir, refPath);
|
|
17948
|
+
if (fs6.existsSync(refFile)) {
|
|
17949
|
+
return fs6.readFileSync(refFile, "utf8").trim();
|
|
17852
17950
|
}
|
|
17853
|
-
const packedRefs =
|
|
17854
|
-
if (
|
|
17855
|
-
const content =
|
|
17951
|
+
const packedRefs = path6.join(gitDir, "packed-refs");
|
|
17952
|
+
if (fs6.existsSync(packedRefs)) {
|
|
17953
|
+
const content = fs6.readFileSync(packedRefs, "utf8");
|
|
17856
17954
|
for (const line of content.split("\n")) {
|
|
17857
17955
|
if (!line || line.startsWith("#") || line.startsWith("^")) continue;
|
|
17858
17956
|
const [sha, ref] = line.split(" ");
|
|
@@ -17867,19 +17965,19 @@ function readGitSha(cwd = process.cwd()) {
|
|
|
17867
17965
|
function findGitDir(start) {
|
|
17868
17966
|
let current = start;
|
|
17869
17967
|
while (true) {
|
|
17870
|
-
const candidate =
|
|
17871
|
-
if (
|
|
17872
|
-
const stat =
|
|
17968
|
+
const candidate = path6.join(current, ".git");
|
|
17969
|
+
if (fs6.existsSync(candidate)) {
|
|
17970
|
+
const stat = fs6.statSync(candidate);
|
|
17873
17971
|
if (stat.isFile()) {
|
|
17874
|
-
const content =
|
|
17972
|
+
const content = fs6.readFileSync(candidate, "utf8").trim();
|
|
17875
17973
|
const match = content.match(/^gitdir: (.+)$/);
|
|
17876
17974
|
if (match) {
|
|
17877
|
-
return
|
|
17975
|
+
return path6.resolve(current, match[1]);
|
|
17878
17976
|
}
|
|
17879
17977
|
}
|
|
17880
17978
|
return candidate;
|
|
17881
17979
|
}
|
|
17882
|
-
const parent =
|
|
17980
|
+
const parent = path6.dirname(current);
|
|
17883
17981
|
if (parent === current) return void 0;
|
|
17884
17982
|
current = parent;
|
|
17885
17983
|
}
|
|
@@ -17890,8 +17988,8 @@ function readBranchName(cwd = process.cwd()) {
|
|
|
17890
17988
|
const gitDir = findGitDir(cwd);
|
|
17891
17989
|
if (!gitDir) return void 0;
|
|
17892
17990
|
try {
|
|
17893
|
-
const headPath =
|
|
17894
|
-
const head =
|
|
17991
|
+
const headPath = path6.join(gitDir, "HEAD");
|
|
17992
|
+
const head = fs6.readFileSync(headPath, "utf8").trim();
|
|
17895
17993
|
if (head.startsWith("ref:")) {
|
|
17896
17994
|
const refPath = head.replace("ref:", "").trim();
|
|
17897
17995
|
const match = refPath.match(/^refs\/heads\/(.+)$/);
|
|
@@ -17928,8 +18026,8 @@ function nanosecondsToMs(ns) {
|
|
|
17928
18026
|
}
|
|
17929
18027
|
|
|
17930
18028
|
// src/utils/metadata.ts
|
|
17931
|
-
var
|
|
17932
|
-
var
|
|
18029
|
+
var fs7 = __toESM(require("fs"), 1);
|
|
18030
|
+
var path7 = __toESM(require("path"), 1);
|
|
17933
18031
|
var versionCache = /* @__PURE__ */ new Map();
|
|
17934
18032
|
function readPackageVersion(root) {
|
|
17935
18033
|
if (versionCache.has(root)) {
|
|
@@ -17940,18 +18038,18 @@ function readPackageVersion(root) {
|
|
|
17940
18038
|
return version;
|
|
17941
18039
|
}
|
|
17942
18040
|
function findPackageVersion(startDir) {
|
|
17943
|
-
let current =
|
|
18041
|
+
let current = path7.resolve(startDir);
|
|
17944
18042
|
while (true) {
|
|
17945
|
-
const pkgPath =
|
|
18043
|
+
const pkgPath = path7.join(current, "package.json");
|
|
17946
18044
|
try {
|
|
17947
|
-
if (
|
|
17948
|
-
const raw =
|
|
18045
|
+
if (fs7.existsSync(pkgPath)) {
|
|
18046
|
+
const raw = fs7.readFileSync(pkgPath, "utf8");
|
|
17949
18047
|
const parsed = JSON.parse(raw);
|
|
17950
18048
|
return parsed.version;
|
|
17951
18049
|
}
|
|
17952
18050
|
} catch {
|
|
17953
18051
|
}
|
|
17954
|
-
const parent =
|
|
18052
|
+
const parent = path7.dirname(current);
|
|
17955
18053
|
if (parent === current) {
|
|
17956
18054
|
return void 0;
|
|
17957
18055
|
}
|
|
@@ -18091,11 +18189,6 @@ function resolveTraceUrl(template, traceId) {
|
|
|
18091
18189
|
return template.replace(/\{traceId\}/g, traceId);
|
|
18092
18190
|
}
|
|
18093
18191
|
|
|
18094
|
-
// src/notifiers/ansi-strip.ts
|
|
18095
|
-
function stripAnsi(text2) {
|
|
18096
|
-
return text2.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
|
|
18097
|
-
}
|
|
18098
|
-
|
|
18099
18192
|
// src/notifiers/slack.ts
|
|
18100
18193
|
function truncate(text2, maxLen) {
|
|
18101
18194
|
if (text2.length <= maxLen) return text2;
|
|
@@ -18942,11 +19035,11 @@ function computeOutputPath(sourceFile, format, mode, colocatedStyle, baseOutputD
|
|
|
18942
19035
|
const ext = FORMAT_EXTENSIONS[format];
|
|
18943
19036
|
const effectiveName = outputName + (outputNameSuffix ?? "");
|
|
18944
19037
|
if (mode === "aggregated") {
|
|
18945
|
-
return toPosix(
|
|
19038
|
+
return toPosix(path8.join(baseOutputDir, `${effectiveName}${ext}`));
|
|
18946
19039
|
}
|
|
18947
19040
|
const normalizedSource = toPosix(sourceFile);
|
|
18948
|
-
const dirOfSource =
|
|
18949
|
-
let baseName =
|
|
19041
|
+
const dirOfSource = path8.posix.dirname(normalizedSource);
|
|
19042
|
+
let baseName = path8.posix.basename(normalizedSource);
|
|
18950
19043
|
for (const testExt of TEST_EXTENSIONS) {
|
|
18951
19044
|
if (baseName.endsWith(testExt)) {
|
|
18952
19045
|
baseName = baseName.slice(0, -testExt.length);
|
|
@@ -18955,9 +19048,9 @@ function computeOutputPath(sourceFile, format, mode, colocatedStyle, baseOutputD
|
|
|
18955
19048
|
}
|
|
18956
19049
|
const fileName = `${baseName}.${effectiveName}${ext}`;
|
|
18957
19050
|
if (colocatedStyle === "adjacent") {
|
|
18958
|
-
return toPosix(
|
|
19051
|
+
return toPosix(path8.posix.join(dirOfSource, fileName));
|
|
18959
19052
|
}
|
|
18960
|
-
return toPosix(
|
|
19053
|
+
return toPosix(path8.posix.join(baseOutputDir, dirOfSource, fileName));
|
|
18961
19054
|
}
|
|
18962
19055
|
function groupTestCasesByOutput(testCases, format, options, logger, outputNameSuffix) {
|
|
18963
19056
|
const groups = /* @__PURE__ */ new Map();
|
|
@@ -19155,8 +19248,8 @@ var ReportGenerator = class {
|
|
|
19155
19248
|
if (astroPaths) {
|
|
19156
19249
|
for (const mdPath of astroPaths) {
|
|
19157
19250
|
const content = await fsPromises.readFile(mdPath, "utf8");
|
|
19158
|
-
const mdDir =
|
|
19159
|
-
const assetsDir =
|
|
19251
|
+
const mdDir = path8.dirname(mdPath);
|
|
19252
|
+
const assetsDir = path8.resolve(this.options.astro.assetsDir);
|
|
19160
19253
|
const result = copyMarkdownAssets({
|
|
19161
19254
|
markdown: content,
|
|
19162
19255
|
markdownDir: mdDir,
|
|
@@ -19187,9 +19280,9 @@ var ReportGenerator = class {
|
|
|
19187
19280
|
if (groups.size === 0 && this.options.output.mode === "aggregated") {
|
|
19188
19281
|
const ext = FORMAT_EXTENSIONS[format];
|
|
19189
19282
|
const effectiveName = this.options.outputName + (outputNameSuffix ?? "");
|
|
19190
|
-
const outputPath = toPosix(
|
|
19283
|
+
const outputPath = toPosix(path8.join(this.options.outputDir, `${effectiveName}${ext}`));
|
|
19191
19284
|
const content = await this.formatContent(run, format);
|
|
19192
|
-
const dir =
|
|
19285
|
+
const dir = path8.dirname(outputPath);
|
|
19193
19286
|
await fsPromises.mkdir(dir, { recursive: true });
|
|
19194
19287
|
await this.deps.writeFile(outputPath, content);
|
|
19195
19288
|
return [outputPath];
|
|
@@ -19201,7 +19294,7 @@ var ReportGenerator = class {
|
|
|
19201
19294
|
testCases
|
|
19202
19295
|
};
|
|
19203
19296
|
const content = await this.formatContent(groupRun, format);
|
|
19204
|
-
const dir =
|
|
19297
|
+
const dir = path8.dirname(outputPath);
|
|
19205
19298
|
await fsPromises.mkdir(dir, { recursive: true });
|
|
19206
19299
|
await this.deps.writeFile(outputPath, content);
|
|
19207
19300
|
writtenPaths.push(outputPath);
|
|
@@ -19324,7 +19417,7 @@ async function generateRunComparison(args) {
|
|
|
19324
19417
|
await fsPromises.mkdir(outputDir, { recursive: true });
|
|
19325
19418
|
for (const format of args.formats) {
|
|
19326
19419
|
const ext = format === "html" ? ".html" : ".md";
|
|
19327
|
-
const outputPath = toPosix(
|
|
19420
|
+
const outputPath = toPosix(path8.join(outputDir, `${outputName}${ext}`));
|
|
19328
19421
|
const content = format === "html" ? new RunDiffHtmlFormatter({ title: args.title }).format(diff) : new RunDiffMarkdownFormatter({ title: args.title }).format(diff);
|
|
19329
19422
|
await fsPromises.writeFile(outputPath, content, "utf8");
|
|
19330
19423
|
files.push(outputPath);
|