42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { resolve as resolvePath } from "node:path";
|
|
import { describe, expect, it } from "@suaveplan/testing/runner";
|
|
|
|
interface PackageJsonShape {
|
|
readonly dependencies?: Readonly<Record<string, string>>;
|
|
}
|
|
|
|
describe("@suaveplan/api-sandbox-wasm — dep graph", () => {
|
|
it("pins the runtime dep set to the documented allowlist", {
|
|
timeout: 5000,
|
|
}, () => {
|
|
const pkg = JSON.parse(
|
|
readFileSync(resolvePath(__dirname, "..", "package.json"), "utf8")
|
|
) as PackageJsonShape;
|
|
const deps = Object.keys(pkg.dependencies ?? {}).sort();
|
|
// The proposal pins the @suaveplan/* runtime surface; external
|
|
// deps (zod, tslib, @opentelemetry/api) come from the host
|
|
// stack and are intentionally not enumerated here.
|
|
expect(deps).toEqual([
|
|
"@opentelemetry/api",
|
|
"@suaveplan/api-types",
|
|
"@suaveplan/error",
|
|
"@suaveplan/logger",
|
|
"tslib",
|
|
"zod",
|
|
]);
|
|
});
|
|
|
|
it("does not depend on any sandbox-host sibling", { timeout: 5000 }, () => {
|
|
const pkg = JSON.parse(
|
|
readFileSync(resolvePath(__dirname, "..", "package.json"), "utf8")
|
|
) as PackageJsonShape;
|
|
const deps = Object.keys(pkg.dependencies ?? {});
|
|
expect(deps.some((d) => d.startsWith("@suaveplan/api-sandbox-"))).toBe(
|
|
false
|
|
);
|
|
expect(deps).not.toContain("@suaveplan/api-host");
|
|
expect(deps).not.toContain("@suaveplan/api-worker-host");
|
|
});
|
|
});
|