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/cli.js +111 -21
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +31 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -18196,6 +18196,37 @@ function listScenarios(args, _deps) {
|
|
|
18196
18196
|
}));
|
|
18197
18197
|
return JSON.stringify(items, null, 2);
|
|
18198
18198
|
}
|
|
18199
|
+
if (format === "csv") {
|
|
18200
|
+
const header = "id,scenario,status,sourceFile,sourceLine,tags";
|
|
18201
|
+
const rows = testCases.map((tc) => {
|
|
18202
|
+
const fields = [
|
|
18203
|
+
tc.id,
|
|
18204
|
+
tc.story.scenario,
|
|
18205
|
+
tc.status,
|
|
18206
|
+
tc.sourceFile,
|
|
18207
|
+
String(tc.sourceLine),
|
|
18208
|
+
tc.tags.join(" ")
|
|
18209
|
+
];
|
|
18210
|
+
return fields.map((f) => {
|
|
18211
|
+
if (f.includes(",") || f.includes('"') || f.includes("\n")) {
|
|
18212
|
+
return `"${f.replace(/"/g, '""')}"`;
|
|
18213
|
+
}
|
|
18214
|
+
return f;
|
|
18215
|
+
}).join(",");
|
|
18216
|
+
});
|
|
18217
|
+
return [header, ...rows].join("\n");
|
|
18218
|
+
}
|
|
18219
|
+
if (format === "markdown-table") {
|
|
18220
|
+
const header = "| Status | Scenario | Location | Tags |";
|
|
18221
|
+
const divider = "|--------|----------|----------|------|";
|
|
18222
|
+
const rows = testCases.map((tc) => {
|
|
18223
|
+
const icon = STATUS_ICONS[tc.status] ?? "?";
|
|
18224
|
+
const location = `${tc.sourceFile}:${tc.sourceLine}`;
|
|
18225
|
+
const tags = tc.tags.map((t) => `@${t}`).join(" ");
|
|
18226
|
+
return `| ${icon} | ${tc.story.scenario} | ${location} | ${tags} |`;
|
|
18227
|
+
});
|
|
18228
|
+
return [header, divider, ...rows].join("\n");
|
|
18229
|
+
}
|
|
18199
18230
|
if (testCases.length === 0) {
|
|
18200
18231
|
return "No scenarios found.";
|
|
18201
18232
|
}
|