fix(test): route release wrapper scripts

This commit is contained in:
Vincent Koc
2026-06-21 17:06:50 +02:00
parent 33eb6ab9de
commit 9d83eeaccf
3 changed files with 94 additions and 0 deletions

View File

@@ -961,14 +961,35 @@ const TOOLING_SOURCE_TEST_TARGETS = new Map([
"scripts/openclaw-release-clawhub-runtime-state.ts",
["test/scripts/openclaw-release-clawhub-runtime-state.test.ts"],
],
[
"scripts/openclaw-release-clawhub-plan.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
[
"scripts/plan-release-workflow-matrix.mjs",
["test/scripts/release-workflow-matrix-plan.test.ts"],
],
[
"scripts/plugin-clawhub-release-check.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
[
"scripts/plugin-clawhub-release-plan.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
[
"scripts/plugin-npm-release-check.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
[
"scripts/plugin-npm-release-plan.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
[
"scripts/plugin-release-pretag-pack-check.ts",
["test/scripts/plugin-release-pretag-pack-check.test.ts"],
],
["scripts/release-verify-beta.ts", ["test/scripts/release-wrapper-scripts.test.ts"]],
[
"scripts/validate-release-publish-approval.mjs",
["test/scripts/validate-release-publish-approval.test.ts"],

View File

@@ -0,0 +1,52 @@
// Release wrapper script tests keep changed-target routing tied to scripts that load the wrappers.
import { spawnSync } from "node:child_process";
import { describe, expect, it } from "vitest";
const UNKNOWN_PACKAGE = "@openclaw/not-a-real-release-wrapper-test-package";
function runTsxScript(scriptPath: string, args: string[]) {
return spawnSync(process.execPath, ["--import", "tsx", scriptPath, ...args], {
cwd: process.cwd(),
encoding: "utf8",
});
}
describe("release wrapper scripts", () => {
it("runs plugin release wrapper CLIs and rejects unknown explicit selections", () => {
for (const scriptPath of [
"scripts/plugin-npm-release-plan.ts",
"scripts/plugin-npm-release-check.ts",
"scripts/plugin-clawhub-release-plan.ts",
"scripts/plugin-clawhub-release-check.ts",
]) {
const result = runTsxScript(scriptPath, ["--plugins", UNKNOWN_PACKAGE]);
expect(result.status, scriptPath).toBe(1);
expect(result.stderr, scriptPath).toContain(
`Unknown or non-publishable plugin package selection: ${UNKNOWN_PACKAGE}.`,
);
expect(result.stdout, scriptPath).toBe("");
}
});
it("loads the OpenClaw ClawHub plan CLI and validates required arguments before planning", () => {
const result = runTsxScript("scripts/openclaw-release-clawhub-plan.ts", [
"--release-tag",
"v2026.6.21-beta.1",
"--release-publish-run-id",
"123",
]);
expect(result.status).toBe(1);
expect(result.stderr).toContain("--release-publish-branch is required.");
expect(result.stdout).toBe("");
});
it("loads the beta verifier CLI and validates required version input before remote checks", () => {
const result = runTsxScript("scripts/release-verify-beta.ts", ["--skip-clawhub"]);
expect(result.status).toBe(1);
expect(result.stderr).toContain("Usage: pnpm release:verify-beta -- <version>");
expect(result.stdout).toBe("");
});
});

View File

@@ -1931,6 +1931,10 @@ describe("scripts/test-projects changed-target routing", () => {
"scripts/openclaw-release-clawhub-runtime-state.ts",
["test/scripts/openclaw-release-clawhub-runtime-state.test.ts"],
],
[
"scripts/openclaw-release-clawhub-plan.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
["scripts/lib/openclaw-release-clawhub-plan.ts", ["test/plugin-clawhub-release.test.ts"]],
[
"scripts/lib/plugin-clawhub-release.ts",
@@ -1940,6 +1944,22 @@ describe("scripts/test-projects changed-target routing", () => {
"scripts/lib/plugin-npm-release.ts",
["test/plugin-npm-release.test.ts", "test/plugin-clawhub-release.test.ts"],
],
[
"scripts/plugin-clawhub-release-check.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
[
"scripts/plugin-clawhub-release-plan.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
[
"scripts/plugin-npm-release-check.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
[
"scripts/plugin-npm-release-plan.ts",
["test/scripts/release-wrapper-scripts.test.ts"],
],
[
"scripts/plugin-release-pretag-pack-check.ts",
["test/scripts/plugin-release-pretag-pack-check.test.ts"],
@@ -1948,6 +1968,7 @@ describe("scripts/test-projects changed-target routing", () => {
"scripts/plan-release-workflow-matrix.mjs",
["test/scripts/release-workflow-matrix-plan.test.ts"],
],
["scripts/release-verify-beta.ts", ["test/scripts/release-wrapper-scripts.test.ts"]],
[
"scripts/validate-release-publish-approval.mjs",
["test/scripts/validate-release-publish-approval.test.ts"],