Initial Commit
This commit is contained in:
42
packages/foundation/flow/undo/tests/dep-graph.test.ts
Normal file
42
packages/foundation/flow/undo/tests/dep-graph.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
|
||||
const pkg = JSON.parse(
|
||||
readFileSync(resolve(import.meta.dirname, "../package.json"), "utf-8")
|
||||
) as Record<string, unknown>;
|
||||
|
||||
describe("dep-graph", () => {
|
||||
it("has sideEffects: false", { timeout: 5000 }, () => {
|
||||
expect(pkg["sideEffects"]).toBe(false);
|
||||
});
|
||||
|
||||
it("has no disallowed @suaveplan/* runtime deps (only error, types, events, diff)", {
|
||||
timeout: 5000,
|
||||
}, () => {
|
||||
const deps = Object.keys(
|
||||
(pkg["dependencies"] as Record<string, string>) ?? {}
|
||||
);
|
||||
const suaveDeps = deps.filter((d) => d.startsWith("@suaveplan/"));
|
||||
const allowed = new Set([
|
||||
"@suaveplan/error",
|
||||
"@suaveplan/types",
|
||||
"@suaveplan/events",
|
||||
"@suaveplan/diff",
|
||||
]);
|
||||
for (const dep of suaveDeps) {
|
||||
expect(allowed.has(dep), `unexpected dep: ${dep}`).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it("workspace deps use workspace:^ range", { timeout: 5000 }, () => {
|
||||
const deps = (pkg["dependencies"] as Record<string, string>) ?? {};
|
||||
for (const [name, version] of Object.entries(deps)) {
|
||||
if (name.startsWith("@suaveplan/")) {
|
||||
expect(version, `${name} should use workspace:^`).toBe(
|
||||
"workspace:^"
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user