This commit is contained in:
matt korwel
2025-07-05 08:27:22 -07:00
committed by GitHub
parent ab96676e36
commit 4963a1eea8
3 changed files with 37 additions and 10 deletions

View File

@@ -47,14 +47,30 @@ export class TestRig {
execSync('sync', { cwd: this.testDir });
}
run(prompt, ...args) {
const output = execSync(
`node ${this.bundlePath} --yolo --prompt "${prompt}" ${args.join(' ')}`,
{
cwd: this.testDir,
encoding: 'utf-8',
},
);
run(promptOrOptions, ...args) {
let command = `node ${this.bundlePath} --yolo`;
const execOptions = {
cwd: this.testDir,
encoding: 'utf-8',
};
if (typeof promptOrOptions === 'string') {
command += ` --prompt "${promptOrOptions}"`;
} else if (
typeof promptOrOptions === 'object' &&
promptOrOptions !== null
) {
if (promptOrOptions.prompt) {
command += ` --prompt "${promptOrOptions.prompt}"`;
}
if (promptOrOptions.stdin) {
execOptions.input = promptOrOptions.stdin;
}
}
command += ` ${args.join(' ')}`;
const output = execSync(command, execOptions);
if (env.KEEP_OUTPUT === 'true') {
const testId = `${env.TEST_FILE_NAME.replace(