test: simplify pi package missing scan

This commit is contained in:
Peter Steinberger
2026-05-08 22:52:04 +01:00
parent 3d5002f2db
commit 1968db9ddd

View File

@@ -37,6 +37,16 @@ function readPiDependencySpecs() {
}));
}
function collectMissingSpecNames(specs: Array<{ name: string; spec?: string }>): string[] {
const names: string[] = [];
for (const entry of specs) {
if (!entry.spec) {
names.push(entry.name);
}
}
return names;
}
function expectNoGraphViolations(violations: string[], message: string) {
expect(violations, message).toEqual([]);
}
@@ -45,7 +55,7 @@ describe("pi package graph guardrails", () => {
it("keeps root Pi packages aligned to the same exact version", () => {
const specs = readPiDependencySpecs();
const missing = specs.filter((entry) => !entry.spec).map((entry) => entry.name);
const missing = collectMissingSpecNames(specs);
expectNoGraphViolations(
missing,
`Missing required root Pi dependencies: ${missing.join(", ") || "<none>"}. Mixed or incomplete Pi root dependencies create an unsupported package graph.`,