gram/packages/scheduler/tests/no-kitchen-import.test.ts
abiwab c156d562aa
All checks were successful
CI / Build, Test & Publish (pull_request) Successful in 4m0s
refactor(scheduler): extract the scheduling engine into its own package
2026-10-04 11:26:53 +02:00

19 lines
661 B
TypeScript

import { describe, expect, it } from "bun:test";
import { readdirSync, readFileSync } from "node:fs";
import { join } from "node:path";
// The scheduler sits below kitchen: it must never import it (nor the parser),
// directly or through a relative path out of the package.
describe("package boundaries", () => {
it("imports nothing from the packages that depend on it", () => {
const dir = join(import.meta.dir, "../src");
const offenders = readdirSync(dir)
.filter((f) => f.endsWith(".ts"))
.filter((f) =>
/from\s+["'](@gram-lang\/|\.\.\/)/.test(
readFileSync(join(dir, f), "utf8"),
),
);
expect(offenders).toEqual([]);
});
});