diff --git a/src/commands/fetch.js b/src/commands/fetch.js index 8a4429f..fceb039 100644 --- a/src/commands/fetch.js +++ b/src/commands/fetch.js @@ -78,6 +78,7 @@ function fetch(repo, options) { const argsString = R.join(' ', args); return core.fetch(argsString, { cwd: repo.workdir(), shell: true }, callback) .then(({ stdout }) => { + const response = generateResponse(); response.raw = stdout; response.fetch = generateFetchStats(stdout); @@ -88,7 +89,7 @@ function fetch(repo, options) { } return response; - }, errorCatchHandler(response)); + }, errorCatchHandler); } export default fetch; diff --git a/src/commands/pull.js b/src/commands/pull.js index 5002584..8b13d58 100644 --- a/src/commands/pull.js +++ b/src/commands/pull.js @@ -77,6 +77,7 @@ function pull(repo, options) { return core.pull(argsString, { cwd: repo.workdir(), shell: true }, callback) .then(({ stdout }) => { + const response = generateResponse(); response.raw = stdout; response.pull = generatePullStats(stdout); @@ -87,7 +88,7 @@ function pull(repo, options) { } return response; - }, errorCatchHandler(response)); + }, errorCatchHandler); } export default pull; diff --git a/src/commands/version.js b/src/commands/version.js index 78cb0a6..ba271ea 100644 --- a/src/commands/version.js +++ b/src/commands/version.js @@ -6,8 +6,8 @@ import { } from '../constants'; import generateResponse from '../utils/generateResponse'; -const version = () => { - return core.version() +const version = () => + core.version() .then(({ stdout, stderr }) => { const response = generateResponse(); response.raw = stdout; diff --git a/src/utils/execHelper.js b/src/utils/execHelper.js index 607cd1a..e6454d1 100644 --- a/src/utils/execHelper.js +++ b/src/utils/execHelper.js @@ -1,9 +1,9 @@ import child from 'child_process'; import R from 'ramda'; -const exec = (command, input, opts) => new Promise( +const exec = (command, input, opts = {}) => new Promise( (resolve, reject) => { - const options = R.mergeDeepRight((opts || {}), { env: process.env }); + const options = R.mergeDeepRight(opts, { env: process.env }); if (process.platform !== 'win32' && !R.contains('/usr/local/bin', options.env.PATH)) { options.env.PATH = `${options.env.PATH}${':/usr/local/bin'}`; diff --git a/test/tests/utils/execHelper.spec.js b/test/tests/utils/execHelper.spec.js index 93c1716..5656759 100644 --- a/test/tests/utils/execHelper.spec.js +++ b/test/tests/utils/execHelper.spec.js @@ -40,7 +40,7 @@ describe('execHelper', () => { mockProcess } = this; - const promise = exec('test', '', { foo: 'bar' }); + const promise = exec('test', ''); execSpy.firstCall.args[2](null, 'some stdout', 'some stderr'); return promise .then((result) => {