import { describe, expect, it } from "@suaveplan/testing/runner"; describe("universal purity", () => { it("dist references no browser or Node globals", { timeout: 5000 }, () => { // This test is a structural guard; the actual check happens at build time. // We verify the package.json sideEffects flag and absence of platform deps. const pkg = require("../package.json"); expect(pkg.sideEffects).toBe(false); const deps = Object.keys(pkg.dependencies ?? {}); for (const dep of deps) { expect(dep).not.toMatch(/^node:/); } }); it("dependency set is limited to the declared workspace deps and zod", { timeout: 5000, }, () => { const pkg = require("../package.json"); const deps = Object.keys(pkg.dependencies ?? {}); const allowed = [ "@opentelemetry/api", "@suaveplan/error", "@suaveplan/events", "@suaveplan/fsm", "@suaveplan/timing", "@suaveplan/types", "tslib", "zod", ]; for (const dep of deps) { expect(allowed).toContain(dep); } }); it("importing the package mutates no global state", { timeout: 5000, }, () => { // Re-importing should not throw or mutate globals. expect(() => import("../src/index")).not.toThrow(); }); });