|
| 1 | +import { spawnSync } from "node:child_process"; |
1 | 2 | import { generateKeyPairSync, sign } from "node:crypto"; |
2 | 3 | // OpenClaw npm postpublish tests validate postpublish verification behavior. |
3 | 4 | import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; |
@@ -687,6 +688,50 @@ describe("collectInstalledPackageErrors", () => { |
687 | 688 | } |
688 | 689 | }); |
689 | 690 |
|
| 691 | + it("verifies every bundled manifest when the build filter exists before module initialization", () => { |
| 692 | + const packageRoot = makeInstalledPackageRoot(); |
| 693 | + |
| 694 | + try { |
| 695 | + const probe = spawnSync( |
| 696 | + process.execPath, |
| 697 | + [ |
| 698 | + "--import", |
| 699 | + "tsx", |
| 700 | + "--eval", |
| 701 | + [ |
| 702 | + 'import { collectInstalledBundledExtensionManifestErrors } from "./scripts/openclaw-npm-postpublish-verify.ts";', |
| 703 | + `process.stdout.write(JSON.stringify(collectInstalledBundledExtensionManifestErrors(${JSON.stringify(packageRoot)})));`, |
| 704 | + ].join("\n"), |
| 705 | + ], |
| 706 | + { |
| 707 | + cwd: process.cwd(), |
| 708 | + encoding: "utf8", |
| 709 | + env: { ...process.env, OPENCLAW_BUNDLED_PLUGIN_BUILD_IDS: "ollama" }, |
| 710 | + timeout: 30_000, |
| 711 | + }, |
| 712 | + ); |
| 713 | + |
| 714 | + expect(probe.error).toBeUndefined(); |
| 715 | + expect(probe.status, probe.stderr).toBe(0); |
| 716 | + expect(JSON.parse(probe.stdout)).toEqual( |
| 717 | + expect.arrayContaining( |
| 718 | + ["ollama", "lmstudio"].map( |
| 719 | + (providerId) => |
| 720 | + `installed bundled extension manifest missing: ${join( |
| 721 | + packageRoot, |
| 722 | + "dist", |
| 723 | + "extensions", |
| 724 | + providerId, |
| 725 | + "package.json", |
| 726 | + )}.`, |
| 727 | + ), |
| 728 | + ), |
| 729 | + ); |
| 730 | + } finally { |
| 731 | + rmSync(packageRoot, { recursive: true, force: true }); |
| 732 | + } |
| 733 | + }); |
| 734 | + |
690 | 735 | it("does not require excluded external or private plugin package manifests", () => { |
691 | 736 | const packageRoot = makeInstalledPackageRoot(); |
692 | 737 |
|
|
0 commit comments