Skip to content

Commit 44b8a1f

Browse files
committed
refactor
1 parent dfe6bd5 commit 44b8a1f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const is = require('check-more-types')
88
// save original spawn right away
99
const oldSpawn = cp.spawn
1010

11-
function spawnStub (file, args, options) {
12-
debug('in spawn stub', file, args)
11+
function spawnStub (command, exitCode, stdout, stderr) {
12+
debug('in spawn stub for command', command)
1313

1414
const listeners = {}
1515
const on = (name, cb) => {
@@ -25,7 +25,6 @@ function spawnStub (file, args, options) {
2525
kill
2626
}
2727

28-
const exitCode = 0
2928
const exitSignal = null
3029

3130
setTimeout(() => {
@@ -49,8 +48,9 @@ function spawnDispatcher (file, args, options) {
4948
const mock = commands[command]
5049
if (mock) {
5150
debug('removing old mock')
51+
const {exitCode, stdout, stderr} = mock
5252
delete commands[command]
53-
return spawnStub(file, args, options)
53+
return spawnStub(command, exitCode, stdout, stderr)
5454
} else {
5555
return oldSpawn(file, args, options)
5656
}

0 commit comments

Comments
 (0)