Skip to content

Commit d65251b

Browse files
committed
Refactor execCommand formatting
1 parent 56ea5e4 commit d65251b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/cli.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ type CommandArg = [string, string | number | boolean];
88

99
describe('cli tests', () => {
1010
const execCommand = (command: string, ...args: CommandArg[]) => {
11-
const quote = (val: string) => `"${val}"`;
12-
const formattedCommand = `${command} ${args.map(([c, a]) => `${c} ${quote(String(a))}`).join(' ')}`;
11+
const formattedCommand = [command, ...args.flatMap(([c, a]) => [c, String(a)])].join(' ');
1312
const goExecSync = goSync(() =>
1413
execSync(`node ${CLI_EXECUTABLE} ${formattedCommand}`, {
1514
stdio: ['pipe', 'pipe', 'pipe'],

0 commit comments

Comments
 (0)