feat: add Vitest test infrastructure for agent and script validation (#337)

Adds Vitest + TypeScript test infrastructure for agent validation. Validates 642 agent files across 14 categories for YAML frontmatter, kebab-case naming, and directory population.
This commit is contained in:
toukanno
2026-04-11 11:54:34 +09:00
committed by GitHub
parent b456845e85
commit 6f342178f3
5 changed files with 278 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
import { describe, it, expect } from "vitest";
import { execSync } from "node:child_process";
import * as fs from "node:fs";
import * as path from "node:path";
const ROOT = path.resolve(__dirname, "..");
const SCRIPTS_DIR = path.join(ROOT, "scripts");
describe("Install validation", () => {
describe("scripts/install.sh", () => {
const installSh = path.join(SCRIPTS_DIR, "install.sh");
it("should exist", () => {
expect(fs.existsSync(installSh)).toBe(true);
});
it("should pass bash syntax check (bash -n)", () => {
const result = execSync(`bash -n "${installSh}" 2>&1`, {
encoding: "utf-8",
timeout: 10_000,
});
// bash -n produces no output on success
expect(result.trim()).toBe("");
});
});
describe("scripts/install.ps1", () => {
const installPs1 = path.join(SCRIPTS_DIR, "install.ps1");
it.todo(
"should exist (PowerShell install script not yet available)"
);
});
describe("scripts/convert.sh", () => {
const convertSh = path.join(SCRIPTS_DIR, "convert.sh");
it("should exist", () => {
expect(fs.existsSync(convertSh)).toBe(true);
});
it("should pass bash syntax check (bash -n)", () => {
const result = execSync(`bash -n "${convertSh}" 2>&1`, {
encoding: "utf-8",
timeout: 10_000,
});
expect(result.trim()).toBe("");
});
});
});