Files
fusion/packages/desktop/scripts/__tests__/test-args.test.ts
gsxdsm c5a8421533 FN-8560: forward desktop test telemetry flags
Desktop test execution now preserves CI reporter and JSON output flags.

- Forward caller-selected Vitest reporters and output files through the desktop test wrapper.
- Add coverage for reporter syntax and shard timing command forwarding.
- Document desktop timing artifact requirements.

Files changed:
 docs/testing.md                                    |  7 ++++-
 packages/desktop/scripts/__tests__/test-args.test.ts | 36 ++++++++++++++++++++++
 packages/desktop/scripts/test-args.ts              | 13 ++++++++
 packages/desktop/scripts/test.ts                   |  3 +-
 scripts/__tests__/ci-test-shard.test.mjs           |  9 ++++++
 5 files changed, 66 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-8560

Fusion-Task-Lineage: 2a89b28d-39f6-4949-aec2-1123c36126cf

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-24 05:30:45 -07:00

37 lines
1.4 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { buildDesktopVitestArgs } from "../test-args";
test("defaults to concise dot output when no caller selects a reporter", () => {
assert.deepEqual(buildDesktopVitestArgs([]), ["run", "--silent=passed-only", "--reporter=dot"]);
assert.deepEqual(buildDesktopVitestArgs(["src/__tests__/main.test.ts"]), [
"run",
"--silent=passed-only",
"src/__tests__/main.test.ts",
"--reporter=dot",
]);
});
test("forwards exact CI JSON timing flags without adding a conflicting default", () => {
const shardFlags = ["--reporter=json", "--outputFile.json=.timings/timings-shard1-0.json"];
assert.deepEqual(buildDesktopVitestArgs(shardFlags), ["run", "--silent=passed-only", ...shardFlags]);
});
test("preserves supported split reporter/output syntax and multiple reporters", () => {
const callerArgs = [
"--reporter",
"json",
"--outputFile.json",
".timings/timings-shard2-0.json",
"--reporter=verbose",
"--shard=1/2",
];
assert.deepEqual(buildDesktopVitestArgs(callerArgs), ["run", "--silent=passed-only", ...callerArgs]);
});
test("recognizes the supported short reporter form", () => {
assert.deepEqual(buildDesktopVitestArgs(["-r=json"]), ["run", "--silent=passed-only", "-r=json"]);
assert.deepEqual(buildDesktopVitestArgs(["-r", "json"]), ["run", "--silent=passed-only", "-r", "json"]);
});