Initial Commit
This commit is contained in:
39
packages/foundation/data/mime/tests/dep-graph.test.ts
Normal file
39
packages/foundation/data/mime/tests/dep-graph.test.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user