Skip to content

Commit 3309db1

Browse files
committed
some testing with child_process.exec for #5
1 parent 906eccc commit 3309db1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/stub-spawn-once-spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const execa = require('execa')
44
const snapshot = require('snap-shot')
55
const la = require('lazy-ass')
66
const is = require('check-more-types')
7+
const cp = require('child_process')
78

89
/* global describe, it */
910

@@ -14,6 +15,22 @@ describe('stub-spawn-once', () => {
1415
return snapshot(execa.shell('echo "hello"'))
1516
})
1617

18+
it('plain child_process.exec', done => {
19+
cp.exec('echo "hello"', (code, stdout, stderr) => {
20+
console.log('echo stdout', stdout.trim())
21+
done()
22+
})
23+
})
24+
25+
it.skip('supports child_process.exec', done => {
26+
const cmd = '/bin/sh -c echo "hello"'
27+
stubSpawnOnce(cmd, 0, 'foo', 'bar')
28+
cp.exec('echo "hello"', (code, stdout, stderr) => {
29+
console.log('echo stdout', stdout.trim())
30+
done()
31+
})
32+
})
33+
1734
describe('stubSpawnOnce', () => {
1835
it('is a function', () => {
1936
la(is.fn(stubSpawnOnce))

0 commit comments

Comments
 (0)