Initial Commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user