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

Function runCli

test/cli.subprocess.test.ts:359–378  ·  view source on GitHub ↗
(args: string[], envOverrides: Record<string, string> = {})

Source from the content-addressed store, hash-verified

357}
358
359function runCli(args: string[], envOverrides: Record<string, string> = {}): Promise<SpawnResult> {
360 return new Promise((resolveResult, rejectResult) => {
361 const child = spawn('node', [BIN_PATH, ...args], {
362 cwd: REPO_ROOT,
363 env: {
364 ...process.env,
365 HOME: tmpHome,
366 TESTSPRITE_API_KEY: undefined,
367 TESTSPRITE_API_URL: undefined,
368 ...envOverrides,
369 } as NodeJS.ProcessEnv,
370 });
371 let stdout = '';
372 let stderr = '';
373 child.stdout.on('data', chunk => (stdout += chunk.toString()));
374 child.stderr.on('data', chunk => (stderr += chunk.toString()));
375 child.on('error', rejectResult);
376 child.on('close', code => resolveResult({ exitCode: code ?? -1, stdout, stderr }));
377 });
378}
379
380describe('auth status subprocess (+ deprecated whoami alias)', () => {
381 it('prints JSON me and exits 0 against the local server', async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected