MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / parseTimeoutFlag

Function parseTimeoutFlag

src/commands/test.ts:4464–4477  ·  view source on GitHub ↗

* Validate the `--timeout` flag value. Returns a clamped integer in * range [1, 3600], or the default when absent.

(raw: string | undefined, flagName: string)

Source from the content-addressed store, hash-verified

4462 * range [1, 3600], or the default when absent.
4463 */
4464function parseTimeoutFlag(raw: string | undefined, flagName: string): number {
4465 if (raw === undefined) return DEFAULT_RUN_TIMEOUT_SECONDS;
4466 const n = Number(raw);
4467 if (!Number.isFinite(n) || !Number.isInteger(n) || n < 1) {
4468 throw localValidationError(
4469 flagName,
4470 `must be an integer between 1 and ${MAX_RUN_TIMEOUT_SECONDS}`,
4471 );
4472 }
4473 if (n > MAX_RUN_TIMEOUT_SECONDS) {
4474 throw localValidationError(flagName, `must be at most ${MAX_RUN_TIMEOUT_SECONDS} seconds`);
4475 }
4476 return n;
4477}
4478
4479/**
4480 * `test run <test-id>` — M3.3 piece-3.

Callers 1

createTestCommandFunction · 0.85

Calls 1

localValidationErrorFunction · 0.70

Tested by

no test coverage detected