Skip to content

Commit

Permalink
Add test for when process.stdout and process.stderr are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
markandrus authored and isaacs committed Nov 12, 2018
1 parent e1087d9 commit ebc7bb6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tap-snapshots/test-tap.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,3 +511,25 @@ tear it down
exports[`test/tap.js TAP autoend=false with teardown > stderr 1`] = `
`

exports[`test/tap.js TAP process.stdout and process.stderr are missing > exit status 1`] = `
{ code: 0, signal: null }
`

exports[`test/tap.js TAP process.stdout and process.stderr are missing > stdout 1`] = `
TAP version 13
ok 1 - stdout gets polyfilled
ok 2 - stderr gets polyfilled
1..2
# {time}
`

exports[`test/tap.js TAP process.stdout and process.stderr are missing > stderr 1`] = `
`
13 changes: 13 additions & 0 deletions test/tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ const cases = {
t.end()
}, 50)
},
'process.stdout and process.stderr are missing': t => {
const stdout = process.stdout
const stderr = process.stderr
delete process.stdout
delete process.stderr
delete require.cache[require.resolve('..')]
require('..')
t.ok(process.stdout, 'stdout gets polyfilled')
t.ok(process.stderr, 'stderr gets polyfilled')
process.stdout = stdout
process.stderr = stderr
t.end()
}
}

const main = t => {
Expand Down

0 comments on commit ebc7bb6

Please sign in to comment.