Files
bot-agents/tests/entrypoints.test.ts
T
Danny Kim c8ffb9cc6f
Agents / agent (pull_request) Has been skipped
Check / check (pull_request) Successful in 49s
Replace NodeJS dict aliases with maps and named field reads
2026-10-19 02:30:54 +09:00

26 lines
945 B
TypeScript

import process from "node:process";
import { fileURLToPath } from "node:url";
import { expect, test } from "vite-plus/test";
import { runCommand } from "#testing";
// Each phase runs as `node src/<phase>/index.ts` with no build step. Node loads the
// whole import graph, stripping types, before the phase reads its first
// variable, so failing on that variable proves every module loads.
const PHASES: [phase: string, firstVariable: string][] = [
["prepare", "ACTION_PATH"],
["run", "GITEA_API_URL"],
["post", "BOT_AGENTS_MANIFEST"],
];
test.each(PHASES)("Node loads the %s phase", async (phase, firstVariable) => {
const path = fileURLToPath(new URL(`../src/${phase}/index.ts`, import.meta.url));
const result = await runCommand(
process.execPath,
[path],
new Map([["PATH", process.env["PATH"] ?? ""]]),
);
expect(result.success).toBe(false);
expect(result.stderr).toContain(`${firstVariable} is not set`);
});