(args: string[], envOverrides: Record<string, string> = {})
| 357 | } |
| 358 | |
| 359 | function 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 | |
| 380 | describe('auth status subprocess (+ deprecated whoami alias)', () => { |
| 381 | it('prints JSON me and exits 0 against the local server', async () => { |
no outgoing calls
no test coverage detected