test(deps): prevent bundled pi core runtimes
This commit is contained in:
+1
-1
@@ -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}'",
|
||||
|
||||
@@ -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<string, string>
|
||||
peerDependencies?: Record<string, string>
|
||||
peerDependenciesMeta?: Record<string, { optional?: boolean }>
|
||||
}
|
||||
|
||||
const CORE_PEERS = ["@earendil-works/pi-ai", "@earendil-works/pi-coding-agent"] as const
|
||||
|
||||
async function readPackageManifest(): Promise<PackageManifest> {
|
||||
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)
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user