Initial Commit
This commit is contained in:
46
packages/ui/react/react-audio-player/tests/exports.test.ts
Normal file
46
packages/ui/react/react-audio-player/tests/exports.test.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
|
||||
const PKG_ROOT = resolve(__dirname, "..");
|
||||
const PKG_JSON = JSON.parse(
|
||||
readFileSync(join(PKG_ROOT, "package.json"), "utf8")
|
||||
) as { exports: Record<string, unknown>; dependencies: Record<string, string> };
|
||||
|
||||
const REQUIRED_SURFACES = [
|
||||
".",
|
||||
"./karaoke",
|
||||
"./karaoke/lrc-parser",
|
||||
"./karaoke/use-lyrics",
|
||||
"./karaoke/lyrics-display",
|
||||
"./error-codes",
|
||||
];
|
||||
|
||||
describe("subpath exports", () => {
|
||||
it("every public surface has a subpath entry", { timeout: 5000 }, () => {
|
||||
for (const surface of REQUIRED_SURFACES) {
|
||||
expect(PKG_JSON.exports[surface]).toBeDefined();
|
||||
}
|
||||
});
|
||||
|
||||
it("sideEffects=false", { timeout: 5000 }, () => {
|
||||
const raw = JSON.parse(
|
||||
readFileSync(join(PKG_ROOT, "package.json"), "utf8")
|
||||
) as { sideEffects: boolean };
|
||||
expect(raw.sideEffects).toBe(false);
|
||||
});
|
||||
|
||||
it("runtime dependency set matches allowlist", {
|
||||
timeout: 5000,
|
||||
}, () => {
|
||||
const deps = Object.keys(PKG_JSON.dependencies).sort();
|
||||
expect(deps).toEqual(
|
||||
[
|
||||
"@suaveplan/error",
|
||||
"@suaveplan/react-audio",
|
||||
"@suaveplan/types",
|
||||
"tslib",
|
||||
].sort()
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user