Files
2026-05-27 23:47:53 +01:00

30 lines
1.0 KiB
TypeScript

import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { describe, expect, it } from "@suaveplan/testing/runner";
const PKG_ROOT = resolve(__dirname, "..");
describe("package shape", () => {
it("declares sideEffects false and explicit-named barrels", {
timeout: 5000,
}, () => {
const pkg = JSON.parse(
readFileSync(resolve(PKG_ROOT, "package.json"), "utf8")
) as { sideEffects?: boolean };
expect(pkg.sideEffects).toBe(false);
const rootBarrel = readFileSync(
resolve(PKG_ROOT, "src/index.ts"),
"utf8"
);
const featureBarrel = readFileSync(
resolve(PKG_ROOT, "src/ecb/index.ts"),
"utf8"
);
// No `export *` of any kind in either barrel (no namespace re-export
// in this package either, so the substring check is sufficient).
expect(rootBarrel.includes("export *")).toBe(false);
expect(featureBarrel.includes("export *")).toBe(false);
});
});