diff --git a/package.json b/package.json index 3f45f32..96e961a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "LICENSE" ], "scripts": { - "test": "npm run typecheck && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-pricing.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-abort.ts && tsx tests/test-stream.ts && tsx tests/test-retry.ts && node tests/test-pi-local.mjs && node tests/test-omp-compat.mjs", + "test": "npm run typecheck && tsx tests/test-package-manifest.ts && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-pricing.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-abort.ts && tsx tests/test-stream.ts && tsx tests/test-retry.ts && node tests/test-pi-local.mjs && node tests/test-omp-compat.mjs", "typecheck": "tsc --noEmit", "format:check": "prettier --check '**/*.{ts,mjs,json,md}'", "format": "prettier --write '**/*.{ts,mjs,json,md}'", diff --git a/tests/test-package-manifest.ts b/tests/test-package-manifest.ts new file mode 100644 index 0000000..a01434f --- /dev/null +++ b/tests/test-package-manifest.ts @@ -0,0 +1,28 @@ +import assert from "node:assert/strict" +import { readFile } from "node:fs/promises" +import { describe, it } from "node:test" + +interface PackageManifest { + dependencies?: Record + peerDependencies?: Record + peerDependenciesMeta?: Record +} + +const CORE_PEERS = ["@earendil-works/pi-ai", "@earendil-works/pi-coding-agent"] as const + +async function readPackageManifest(): Promise { + const contents = await readFile(new URL("../package.json", import.meta.url), "utf-8") + return JSON.parse(contents) as PackageManifest +} + +describe("package manifest", () => { + it("uses pi's bundled core packages instead of installing private runtime copies", async () => { + const manifest = await readPackageManifest() + + for (const packageName of CORE_PEERS) { + assert.equal(manifest.dependencies?.[packageName], undefined) + assert.equal(manifest.peerDependencies?.[packageName], "*") + assert.equal(manifest.peerDependenciesMeta?.[packageName]?.optional, true) + } + }) +})