Skip to content

Commit

Permalink
Improve debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-yeager committed Oct 3, 2024
1 parent d0d8c28 commit f14df4f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions acceptance-tests/lib/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import concat from 'concat-stream';
const PATH = process.env.PATH;

export function createProcess(
cliPath: string,
cliVersion: string,
config: TestConfig,
args: string[] = [],
env = null
) {
let processCommand: string;
const { cliVersion, cliPath, debug } = config;

if (cliVersion) {
processCommand = 'npx';
Expand All @@ -33,6 +33,10 @@ export function createProcess(
args = [cliPath].concat(args);
}

if (debug) {
args.push('--debug');
}

// This works for node based CLIs, but can easily be adjusted to
// any other process installed in the system
return spawn(processCommand, args, {
Expand Down Expand Up @@ -62,12 +66,7 @@ function executeWithInput(
opts.env = { BROWSER: 'none' };

const { env = opts.env, timeout = 500, maxTimeout = 30000 } = opts;
const childProcess = createProcess(
config.cliPath,
config.cliVersion,
args,
env
);
const childProcess = createProcess(config, args, env);
childProcess.stdin.setEncoding('utf-8');

let currentInputTimeout: NodeJS.Timeout;
Expand Down

0 comments on commit f14df4f

Please sign in to comment.