40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
/**
|
|
* Dependency-graph guard for @suaveplan/mime.
|
|
*
|
|
* Asserts that the compiled package.json declares only the allowed direct
|
|
* dependencies and that no disallowed peer imports appear at runtime.
|
|
*/
|
|
import { describe, expect, it } from "@suaveplan/testing/runner";
|
|
import pkg from "../package.json";
|
|
|
|
const ALLOWED_DEPS = new Set([
|
|
"@suaveplan/error",
|
|
"@suaveplan/types",
|
|
"tslib",
|
|
"zod",
|
|
]);
|
|
|
|
describe("dependency graph", () => {
|
|
it("has no unexpected production dependencies", { timeout: 5000 }, () => {
|
|
const deps = Object.keys(pkg.dependencies ?? {});
|
|
for (const dep of deps) {
|
|
expect(ALLOWED_DEPS.has(dep), `Unexpected dep: ${dep}`).toBe(true);
|
|
}
|
|
});
|
|
|
|
it("does not depend on Node-only packages", { timeout: 5000 }, () => {
|
|
const deps = Object.keys({
|
|
...pkg.dependencies,
|
|
...pkg.devDependencies,
|
|
});
|
|
const nodeOnly = deps.filter(
|
|
(d) =>
|
|
d.startsWith("node:") ||
|
|
d === "fs" ||
|
|
d === "path" ||
|
|
d === "crypto"
|
|
);
|
|
expect(nodeOnly).toEqual([]);
|
|
});
|
|
});
|