29 lines
878 B
TypeScript
29 lines
878 B
TypeScript
import { readFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "@suaveplan/testing/runner";
|
|
|
|
const ALLOWED_RUNTIME_DEPS = new Set([
|
|
"@opentelemetry/api",
|
|
"@suaveplan/error",
|
|
"@suaveplan/events",
|
|
"@suaveplan/opentelemetry",
|
|
"@suaveplan/types",
|
|
"tslib",
|
|
"zod",
|
|
]);
|
|
|
|
describe("dependency graph", () => {
|
|
it("runtime dependencies are restricted to the declared allowlist", {
|
|
timeout: 5000,
|
|
}, async () => {
|
|
const pkg = JSON.parse(
|
|
await readFile(join(__dirname, "..", "package.json"), "utf8")
|
|
) as { dependencies: Record<string, string> };
|
|
const declared = new Set(Object.keys(pkg.dependencies));
|
|
const extras = [...declared].filter(
|
|
(d) => !ALLOWED_RUNTIME_DEPS.has(d)
|
|
);
|
|
expect(extras).toEqual([]);
|
|
});
|
|
});
|