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

Function validateStatusFilter

src/commands/test.ts:7630–7643  ·  view source on GitHub ↗

* §6.6 / M2.1 piece 2 — validate the `--status ` flag client * side. Empty / undefined → no filter. Each token must be a public * status value; unknown tokens fail with VALIDATION_ERROR (exit 5) * before the request hits the wire so a typo like `--status fail` * gets a pointed error includ

(raw: string | undefined)

Source from the content-addressed store, hash-verified

7628 * gets a pointed error including the accepted set.
7629 */
7630function validateStatusFilter(raw: string | undefined): void {
7631 if (raw === undefined || raw === '') return;
7632 for (const token of raw.split(',')) {
7633 const trimmed = token.trim();
7634 if (trimmed === '') continue;
7635 if (!PUBLIC_STATUSES.includes(trimmed as CliPublicStatus)) {
7636 throw localValidationError(
7637 'status',
7638 `must be one of: ${PUBLIC_STATUSES.join(', ')} (comma-separated for multiple)`,
7639 [...PUBLIC_STATUSES],
7640 );
7641 }
7642 }
7643}
7644
7645function parseEnumFlag<T extends string>(
7646 raw: string | undefined,

Callers 3

runListFunction · 0.85
runDeleteBatchFunction · 0.85
runTestRerunFunction · 0.85

Calls 1

localValidationErrorFunction · 0.70

Tested by

no test coverage detected