Files
openclaw/test/extension-package-tsc-boundary.test.ts
2026-04-07 10:15:34 +01:00

31 lines
1.1 KiB
TypeScript

import { spawnSync } from "node:child_process";
import { resolve } from "node:path";
import { describe, expect, it } from "vitest";
const REPO_ROOT = resolve(import.meta.dirname, "..");
const CHECK_EXTENSION_PACKAGE_BOUNDARY_BIN = resolve(
REPO_ROOT,
"scripts/check-extension-package-tsc-boundary.mjs",
);
function runNode(args: string[], timeout: number) {
return spawnSync(process.execPath, args, {
cwd: REPO_ROOT,
encoding: "utf8",
maxBuffer: 16 * 1024 * 1024,
timeout,
});
}
describe("opt-in extension package TypeScript boundaries", () => {
it("typechecks each opt-in extension cleanly through @openclaw/plugin-sdk", () => {
const result = runNode([CHECK_EXTENSION_PACKAGE_BOUNDARY_BIN, "--mode=compile"], 420_000);
expect(result.status, `${result.stdout}\n${result.stderr}`).toBe(0);
}, 300_000);
it("fails when opt-in extensions import src/cli through a relative path", () => {
const result = runNode([CHECK_EXTENSION_PACKAGE_BOUNDARY_BIN, "--mode=canary"], 180_000);
expect(result.status, `${result.stdout}\n${result.stderr}`).toBe(0);
});
});