test: require plugin npm provenance repository

This commit is contained in:
Peter Steinberger
2026-05-02 00:48:42 +01:00
parent 106f8a4288
commit 632b9f697e
2 changed files with 52 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import {
collectPublishablePluginPackages,
collectChangedExtensionIdsFromPaths,
collectPublishablePluginPackageErrors,
OPENCLAW_PLUGIN_NPM_REPOSITORY_URL,
parsePluginReleaseArgs,
parsePluginReleaseSelection,
parsePluginReleaseSelectionMode,
@@ -90,6 +91,10 @@ describe("collectPublishablePluginPackageErrors", () => {
packageJson: {
name: "@openclaw/zalo",
version: "2026.3.15",
repository: {
type: "git",
url: OPENCLAW_PLUGIN_NPM_REPOSITORY_URL,
},
openclaw: {
extensions: ["./index.ts"],
release: {
@@ -121,10 +126,32 @@ describe("collectPublishablePluginPackageErrors", () => {
).toEqual([
'package name must start with "@openclaw/"; found "broken".',
"package.json private must not be true.",
`package.json repository.url must be "${OPENCLAW_PLUGIN_NPM_REPOSITORY_URL}" so npm provenance can validate GitHub trusted publishing; found "<missing>".`,
'package.json version must match YYYY.M.D, YYYY.M.D-N, or YYYY.M.D-beta.N; found "latest".',
"openclaw.extensions must contain only non-empty strings.",
]);
});
it("requires the GitHub repository URL npm provenance validates for trusted publishing", () => {
expect(
collectPublishablePluginPackageErrors({
extensionId: "twitch",
packageDir: bundledPluginRoot("twitch"),
packageJson: {
name: "@openclaw/twitch",
version: "2026.5.1-beta.1",
openclaw: {
extensions: ["./index.ts"],
release: {
publishToNpm: true,
},
},
},
}),
).toEqual([
`package.json repository.url must be "${OPENCLAW_PLUGIN_NPM_REPOSITORY_URL}" so npm provenance can validate GitHub trusted publishing; found "<missing>".`,
]);
});
});
describe("collectPublishablePluginPackages", () => {
@@ -134,6 +161,10 @@ describe("collectPublishablePluginPackages", () => {
writeJsonFile(join(repoDir, "extensions", "demo-plugin", "package.json"), {
name: "@openclaw/demo-plugin",
version: "2026.4.10",
repository: {
type: "git",
url: OPENCLAW_PLUGIN_NPM_REPOSITORY_URL,
},
openclaw: {
extensions: ["./index.ts"],
install: {
@@ -164,6 +195,10 @@ describe("collectPublishablePluginPackages", () => {
writeJsonFile(join(repoDir, "extensions", "demo-plugin", "package.json"), {
name: "@openclaw/demo-plugin",
version: "2026.4.10-beta.1",
repository: {
type: "git",
url: OPENCLAW_PLUGIN_NPM_REPOSITORY_URL,
},
openclaw: {
extensions: ["./index.ts"],
release: {