index.spec.js
function (fn) {
    var origError = console.error
    var origExit = process.exit
    var origLog = console.log

    console.error = error = jest.fn()
    console.log = print = jest.fn()
    process.exit = exit = jest.fn()

    return execPromise(fn).then(
      function (value) {
        console.error = origError
        console.log = origLog
        process.exit = origExit

        return value
      },
      function (reason) {
        console.error = origError
        console.log = origLog
        process.exit = origExit

        throw reason
      }
    )
  }
function (fn) {
    var origError = console.error
    var origExit = process.exit
    var origLog = console.log

    console.error = error = jest.fn()
    console.log = print = jest.fn()
    process.exit = exit = jest.fn()

    return execPromise(fn).then(
      function (value) {
        console.error = origError
        console.log = origLog
        process.exit = origExit

        return value
      },
      function (reason) {
        console.error = origError
        console.log = origLog
        process.exit = origExit

        throw reason
      }
    )
  }
function ( fn ) { var origError = console . error var origExit = process . exit var origLog = console . log console . error = error = jest . fn ( ) console . log = print = jest . fn ( ) process . exit = exit = jest . fn ( ) return execPromise ( fn ) . then ( function ( value ) { console . error = origError console . log = origLog process . exit = origExit return value } , function ( reason ) { console . error = origError console . log = origLog process . exit = origExit throw reason } ) }
Helper which runs execPromise with spies.
Helper which runs execPromise with spies .