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);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
// Polyfills for test environment — none required. The package is universal
|
||||
// and uses only `globalThis.fetch` (overridable via `FetchLike` injection),
|
||||
// `Response`, `Number.parseFloat`, `Date.now`, `Object.entries`, and `RegExp`
|
||||
// — all available in every supported runtime (Node 18+, Bun, browsers, Web
|
||||
// Workers). This file exists to give vitest a stable setup-file path mirroring
|
||||
// the sibling-package layout.
|
||||
export { };
|
||||
Reference in New Issue
Block a user