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); });