fix(release): validate plugin clawhub publish args · openclaw/openclaw@498ff1f
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1147,6 +1147,49 @@ describe("buildOpenClawReleaseClawHubRuntimeState", () => {
|
1147 | 1147 | }); |
1148 | 1148 | |
1149 | 1149 | describe("plugin-clawhub-publish.sh", () => { |
| 1150 | +it("prints help before package or ClawHub checks", () => { |
| 1151 | +const output = execFileSync( |
| 1152 | +"bash", |
| 1153 | +[join(process.cwd(), "scripts/plugin-clawhub-publish.sh"), "--help"], |
| 1154 | +{ |
| 1155 | +encoding: "utf8", |
| 1156 | +}, |
| 1157 | +); |
| 1158 | + |
| 1159 | +expect(output.trim()).toBe( |
| 1160 | +"usage: bash scripts/plugin-clawhub-publish.sh [--dry-run|--publish|--pack] <package-dir>", |
| 1161 | +); |
| 1162 | +}); |
| 1163 | + |
| 1164 | +it("rejects option-like package dirs before package or ClawHub checks", () => { |
| 1165 | +expect(() => |
| 1166 | +execFileSync( |
| 1167 | +"bash", |
| 1168 | +[join(process.cwd(), "scripts/plugin-clawhub-publish.sh"), "--dry-run", "--wat"], |
| 1169 | +{ |
| 1170 | +encoding: "utf8", |
| 1171 | +}, |
| 1172 | +), |
| 1173 | +).toThrow("unexpected plugin ClawHub package-dir option: --wat"); |
| 1174 | +}); |
| 1175 | + |
| 1176 | +it("rejects extra arguments before package or ClawHub checks", () => { |
| 1177 | +expect(() => |
| 1178 | +execFileSync( |
| 1179 | +"bash", |
| 1180 | +[ |
| 1181 | +join(process.cwd(), "scripts/plugin-clawhub-publish.sh"), |
| 1182 | +"--dry-run", |
| 1183 | +"extensions/demo-plugin", |
| 1184 | +"extra", |
| 1185 | +], |
| 1186 | +{ |
| 1187 | +encoding: "utf8", |
| 1188 | +}, |
| 1189 | +), |
| 1190 | +).toThrow("unexpected plugin ClawHub publish argument: extra"); |
| 1191 | +}); |
| 1192 | + |
1150 | 1193 | it("previews the publish command through the ClawHub CLI dry-run preflight", () => { |
1151 | 1194 | const repoDir = createTempPluginRepo(); |
1152 | 1195 | const binDir = join(repoDir, "bin"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。