diff --git a/lib/spawn-command.js b/lib/spawn-command.js index 3bd29bec..83960f0c 100644 --- a/lib/spawn-command.js +++ b/lib/spawn-command.js @@ -15,7 +15,7 @@ const spawnCommand = module.exports; * @param {object} [opt] any execa options * @return {String} spawned process reference */ -spawnCommand.spawnCommand = (command, args, opt) => { +spawnCommand.spawnCommand = function (command, args, opt) { return spawn(command, args, {stdio: 'inherit', cwd: this.cwd, ...opt}); }; @@ -27,6 +27,6 @@ spawnCommand.spawnCommand = (command, args, opt) => { * @param {object} [opt] any execa options * @return {String} spawn.sync result */ -spawnCommand.spawnCommandSync = (command, args, opt) => { +spawnCommand.spawnCommandSync = function (command, args, opt) { return spawn.sync(command, args, {stdio: 'inherit', cwd: this.cwd, ...opt}); }; diff --git a/test/spawn-command.js b/test/spawn-command.js index 784df06b..e55cf771 100644 --- a/test/spawn-command.js +++ b/test/spawn-command.js @@ -8,9 +8,10 @@ describe('environment (spawn-command)', () => { beforeEach(function () { this.spawnLib = sinon.stub(); this.spawnLib.sync = sinon.stub(); - this.spawn = proxyquire('../lib/spawn-command', { + this.spawn = {}; + Object.assign(this.spawn, proxyquire('../lib/spawn-command', { execa: this.spawnLib - }); + })); cwd = Math.random().toString(36).slice(7); this.spawn.cwd = cwd; });