MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / parseArgs

Function parseArgs

scripts/run-tests.mjs:78–105  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

76}
77
78function parseArgs(argv) {
79 let scope = "all";
80 let filter = null;
81
82 for (let i = 0; i < argv.length; i++) {
83 const a = argv[i];
84 if (a === "--scope") {
85 const v = argv[i + 1];
86 if (v === "all" || v === "scripts" || v === "packages") {
87 scope = v;
88 i++;
89 continue;
90 }
91 throw new Error(`run-tests: invalid --scope value: ${String(v)}`);
92 }
93
94 if (a === "--filter") {
95 const v = argv[i + 1];
96 if (typeof v !== "string" || v.trim().length === 0 || v.startsWith("--")) {
97 throw new Error("run-tests: --filter requires a non-empty pattern string");
98 }
99 filter = v;
100 i++;
101 }
102 }
103
104 return { scope, filter };
105}
106
107const root = process.cwd();
108const { scope, filter } = parseArgs(process.argv.slice(2));

Callers 1

run-tests.mjsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected