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

Function parseArgs

scripts/testing-slices.mjs:152–175  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

150});
151
152function parseArgs(argv) {
153 const [command, value, extra] = argv;
154 const json = argv.includes("--json");
155
156 if (command === "summary") {
157 const unexpected = argv.slice(1).filter((arg) => arg !== "--json");
158 if (unexpected.length > 0) {
159 throw new Error(`testing-slices: unexpected extra argument: ${unexpected[0]}`);
160 }
161 return { command, json };
162 }
163
164 if (command === "run") {
165 if (typeof value !== "string" || value.length === 0) {
166 throw new Error("testing-slices: run requires a slice name");
167 }
168 if (typeof extra === "string") {
169 throw new Error(`testing-slices: unexpected extra argument: ${extra}`);
170 }
171 return { command, slice: value, json };
172 }
173
174 throw new Error("testing-slices: expected `summary` or `run <slice>`");
175}
176
177function collectReferenceScenarios() {
178 const dir = join(root, "packages", "core", "src", "testing", "referenceScenarios");

Callers 1

testing-slices.mjsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected