mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-31 18:30:39 +02:00
refactor(test): first runBin migration batch (3 of ~36 run() duplicates)
explain-level-config, benchmark-cli, evidence move onto the shared helper; each file's remaining special-case spawnSync sites (raw-buffer probes, env-scrub probes) stay put deliberately. 55/55 green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
1055561cae
commit
6ef8aaba65
@@ -13,6 +13,8 @@
|
||||
|
||||
import { describe, test, expect } from 'bun:test';
|
||||
import { spawnSync } from 'child_process';
|
||||
|
||||
import { runBin } from './helpers/run-bin';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
@@ -21,16 +23,15 @@ const ROOT = path.resolve(import.meta.dir, '..');
|
||||
const BIN = path.join(ROOT, 'bin', 'gstack-model-benchmark');
|
||||
|
||||
function run(args: string[], opts: { env?: Record<string, string> } = {}): { status: number | null; stdout: string; stderr: string } {
|
||||
const result = spawnSync('bun', ['run', BIN, ...args], {
|
||||
const result = runBin('bun', ['run', BIN, ...args], {
|
||||
cwd: ROOT,
|
||||
env: { ...process.env, ...opts.env },
|
||||
encoding: 'utf-8',
|
||||
timeout: 15000,
|
||||
env: opts.env,
|
||||
timeoutMs: 15000,
|
||||
});
|
||||
return {
|
||||
status: result.status,
|
||||
stdout: result.stdout?.toString() ?? '',
|
||||
stderr: result.stderr?.toString() ?? '',
|
||||
stdout: result.stdout,
|
||||
stderr: result.stderr,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user