mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
c70aee247e
* refactor(scripts): migrate JavaScript tools to TypeScript * fix(ci): keep changed-scope preflight zero-install * fix(ci): preserve zero-install script owners * fix(ci): complete script migration follow-through * fix(release): keep stable closeout zero-install * fix(scripts): preserve standalone execution boundaries * fix(scripts): repair standalone loader boundaries * fix(scripts): normalize gateway observation ids * fix(scripts): keep Docker packager standalone * test(scripts): preserve rebase cleanup helpers * test(sessions): use tracked temp directory
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { parseRunArgs } from "../../scripts/lib/plugin-npm-package-manifest.mts";
|
|
|
|
const usage =
|
|
"usage: node scripts/lib/plugin-npm-package-manifest.mjs --run <package-dir> -- <command> [args...]";
|
|
|
|
describe("plugin-npm-package-manifest run args", () => {
|
|
it("parses package-scoped run commands", () => {
|
|
expect(parseRunArgs(["--run", "extensions/slack", "--", "npm", "pack"])).toEqual({
|
|
packageDir: "extensions/slack",
|
|
command: "npm",
|
|
args: ["pack"],
|
|
});
|
|
});
|
|
|
|
it("returns help before resolving package dirs", () => {
|
|
expect(parseRunArgs(["--help"])).toEqual({
|
|
help: true,
|
|
packageDir: "",
|
|
command: "",
|
|
args: [],
|
|
});
|
|
});
|
|
|
|
it("rejects missing or option-looking package dirs", () => {
|
|
expect(() => parseRunArgs(["--run"])).toThrow(usage);
|
|
expect(() => parseRunArgs(["--run", "--", "npm", "pack"])).toThrow(usage);
|
|
expect(() => parseRunArgs(["--run", "--bad", "--", "npm", "pack"])).toThrow(usage);
|
|
});
|
|
|
|
it("rejects unexpected args before the command separator", () => {
|
|
expect(() => parseRunArgs(["--run", "extensions/slack", "extra", "--", "npm"])).toThrow(
|
|
"unexpected plugin npm package manifest run argument: extra",
|
|
);
|
|
});
|
|
});
|