Skip to content

Commit 50c981a

Browse files
fix: make opts optional (#3)
1 parent 2040e04 commit 50c981a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const isPipe = (stdio = 'pipe', fd) =>
66
: false
77

88
// 'extra' object is for decorating the error a bit more
9-
const promiseSpawn = (cmd, args, opts, extra = {}) => {
9+
const promiseSpawn = (cmd, args, opts = {}, extra = {}) => {
1010
const cwd = opts.cwd || process.cwd()
1111
return promiseSpawnUid(cmd, args, {
1212
...opts,

test/promise-spawn.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ t.test('pass', t => t.resolveMatch(promiseSpawn('pass', [], {stdioString: true},
115115
a: 1,
116116
}))
117117

118+
t.test('pass, default opts', t => t.resolveMatch(promiseSpawn('pass', []), {
119+
code: 0,
120+
signal: null
121+
}))
122+
118123
t.test('pass, share stdio', t => t.resolveMatch(promiseSpawn('pass', [], { stdio: 'inherit'}, {a: 1}), {
119124
code: 0,
120125
signal: null,

0 commit comments

Comments
 (0)