mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-24 10:58:37 +00:00
test(scripts): route extensionless helper scripts
This commit is contained in:
@@ -1059,6 +1059,8 @@ const TOOLING_SOURCE_TEST_TARGETS = new Map([
|
||||
["scripts/run-oxlint-shards.mjs", ["test/scripts/run-oxlint.test.ts"]],
|
||||
["scripts/run-with-env.mjs", ["test/scripts/run-with-env.test.ts"]],
|
||||
["scripts/run-node.mjs", ["src/infra/run-node.test.ts"]],
|
||||
["scripts/committer", ["test/scripts/committer.test.ts"]],
|
||||
["scripts/gh-read", ["test/scripts/gh-read.test.ts"]],
|
||||
["scripts/setup-auth-system.sh", ["test/scripts/test-projects.test.ts"]],
|
||||
["scripts/ci-run-timings.mjs", ["test/scripts/ci-run-timings.test.ts"]],
|
||||
["scripts/docker-e2e.mjs", ["test/scripts/docker-e2e-helper-cli.test.ts"]],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gh Read tests cover gh read script behavior.
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
buildReadPermissions,
|
||||
@@ -16,6 +17,22 @@ describe("gh-read helpers", () => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it("prints wrapper usage before reading auth env", () => {
|
||||
let stderr = "";
|
||||
try {
|
||||
execFileSync("bash", ["scripts/gh-read"], {
|
||||
cwd: process.cwd(),
|
||||
encoding: "utf8",
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
} catch (error) {
|
||||
stderr = String((error as { stderr?: unknown }).stderr ?? error);
|
||||
}
|
||||
|
||||
expect(stderr).toContain("usage: scripts/gh-read <gh args...>");
|
||||
expect(stderr).toContain("OPENCLAW_GH_READ_APP_ID");
|
||||
});
|
||||
|
||||
it("finds repo from gh args", () => {
|
||||
expect(parseRepoArg(["pr", "view", "42", "-R", "openclaw/openclaw"])).toBe("openclaw/openclaw");
|
||||
expect(parseRepoArg(["run", "list", "--repo=openclaw/docs"])).toBe("openclaw/docs");
|
||||
|
||||
@@ -1348,6 +1348,20 @@ describe("scripts/test-projects changed-target routing", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps extensionless helper script edits on owner tests", () => {
|
||||
const expectedTargets = new Map([
|
||||
["scripts/committer", ["test/scripts/committer.test.ts"]],
|
||||
["scripts/gh-read", ["test/scripts/gh-read.test.ts"]],
|
||||
]);
|
||||
|
||||
for (const [source, targets] of expectedTargets) {
|
||||
expect(resolveChangedTestTargetPlan([source]), source).toEqual({
|
||||
mode: "targets",
|
||||
targets,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps shared script library edits on owner tests", () => {
|
||||
const expectedTargets = new Map([
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user