Files
clean-architecture-frontend…/tests/integration/vitest-collection.test.ts
DongHyeonkaandClaude Opus 5.5 72e7ae1139 test(vitest): collect only Vitest files and document running one file (10-05)
A bare vitest run collected 26 Playwright specs and the host-bound system
suite. The documented one-file command goes through run-vitest.ts, which
renders the gitignored product index a fresh clone lacks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 00:22:16 +09:00

32 lines
1.0 KiB
TypeScript

import { spawnSync } from "node:child_process";
import { describe, expect, it } from "vitest";
function listTestFiles(...filters: string[]): string[] {
const result = spawnSync(
process.execPath,
["node_modules/vitest/vitest.mjs", "list", "--filesOnly", ...filters],
{ encoding: "utf8" },
);
expect(result.status, result.stderr).toBe(0);
return result.stdout.split("\n").filter((line) => line.length > 0);
}
describe("Vitest file collection", () => {
it("leaves Playwright specs and host system tests out of a bare run", () => {
const files = listTestFiles();
expect(files).toContain("tests/integration/vitest-collection.test.ts");
expect(files.filter((file) => file.endsWith(".spec.ts"))).toEqual([]);
expect(files.filter((file) => file.startsWith("tests/system/"))).toEqual(
[],
);
}, 30_000);
it("still collects system tests when test:system names them", () => {
expect(listTestFiles("tests/system")).toContain(
"tests/system/ci-runner/ci-evidence-freshness.test.ts",
);
}, 30_000);
});