Files
suaveplan/packages/foundation/data/serialize/tests/tree-shake.test.ts
2026-05-27 23:47:53 +01:00

28 lines
987 B
TypeScript

import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "@suaveplan/testing/runner";
describe("tree-shake: main bundle isolation", () => {
it("package.json has sideEffects: false", { timeout: 5000 }, () => {
const pkgPath = join(import.meta.dirname, "..", "package.json");
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as {
sideEffects?: boolean;
};
expect(pkg.sideEffects).toBe(false);
});
it("dist/index.js does not reference serialize-javascript", {
timeout: 5000,
}, () => {
const distPath = join(import.meta.dirname, "..", "dist", "index.js");
let content: string;
try {
content = readFileSync(distPath, "utf-8");
} catch {
// Build hasn't run yet in test-only mode — skip gracefully.
return;
}
expect(content).not.toContain("serialize-javascript");
});
});