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

Function resolveCommonOptions

src/commands/test.ts:7666–7686  ·  view source on GitHub ↗
(command: Command)

Source from the content-addressed store, hash-verified

7664}
7665
7666function resolveCommonOptions(command: Command): CommonOptions {
7667 const globals = command.optsWithGlobals() as Partial<CommonOptions> & {
7668 requestTimeout?: string;
7669 };
7670 // P2-8: validate --output before allowing silent fallback to 'text'.
7671 // An invalid value (e.g. `--output yaml`) must exit 5 with a clear error
7672 // rather than silently treating the request as text mode.
7673 const rawOutput = globals.output;
7674 if (rawOutput !== undefined && rawOutput !== 'json' && rawOutput !== 'text') {
7675 throw localValidationError('output', 'must be one of: json, text', ['json', 'text']);
7676 }
7677 return {
7678 profile: globals.profile ?? 'default',
7679 output: (globals.output as OutputMode | undefined) ?? 'text',
7680 dryRun: globals.dryRun ?? false,
7681 endpointUrl: globals.endpointUrl,
7682 debug: globals.debug ?? false,
7683 verbose: globals.verbose ?? false,
7684 requestTimeoutMs: parseRequestTimeoutFlag(globals.requestTimeout),
7685 };
7686}
7687
7688/**
7689 * Parse the `--request-timeout <seconds>` flag value into milliseconds.

Callers 5

createTestCommandFunction · 0.70
createTestCodeCommandFunction · 0.70
createTestPlanCommandFunction · 0.70
createTestFailureCommandFunction · 0.70

Calls 2

localValidationErrorFunction · 0.70
parseRequestTimeoutFlagFunction · 0.70

Tested by

no test coverage detected