diff --git a/src/main/ts/invoke.ts b/src/main/ts/invoke.ts index e5049e96..9058d611 100644 --- a/src/main/ts/invoke.ts +++ b/src/main/ts/invoke.ts @@ -3,7 +3,11 @@ import cp from 'child_process' export const invoke = (cmd: string, args: string[], cwd: string) => { const result = cp.spawnSync(cmd, args, {cwd}) + console.log('invoke', cmd, ...args) + if (result.error || result.status !== 0) { throw result.error || result.stderr.toString('utf-8') } + + console.log(result.stdout.toString('utf-8')) } diff --git a/src/test/ts/index.ts b/src/test/ts/index.ts index f6b90fc0..a4d97745 100644 --- a/src/test/ts/index.ts +++ b/src/test/ts/index.ts @@ -19,7 +19,7 @@ describe('yarn-audit-fix', () => { // @ts-ignore synp.yarnToNpm.mockImplementation(() => '{}') // @ts-ignore - cp.spawnSync.mockImplementation(() => ({status: 0})) + cp.spawnSync.mockImplementation(() => ({status: 0, stdout: 'foobar'})) }) afterAll(jest.clearAllMocks)