src/__tests__/simple-react-docgen-test.js
// run the simple-react-docgen script with optional stdin param */
run the simple-react-docgen script with optional stdin param
run the simple - react - docgen script with optional stdin param
function run(args, stdin) {
  var stdout = ''
  var stderr = ''
  return new Promise(resolve => {
    let binPath = path.join(__dirname, '../../dist/simple-react-docgen.js')
    fs.chmodSync(binPath, '0777')
    let spawned = spawn(binPath, args)
    spawned.stdout.on('data', data => stdout += data)
    spawned.stderr.on('data', data => stderr += data)
    spawned.on('close', () => resolve([stdout, stderr]))
    spawned.on('error', e => { throw(e) } )
    if (stdin) {
      spawned.stdin.write(stdin)
    }
    spawned.stdin.end()
  })
}
function run ( args , stdin ) { var stdout = '' var stderr = '' return new Promise ( resolve => { let binPath = path . join ( __dirname , '../../dist/simple-react-docgen.js' ) fs . chmodSync ( binPath , '0777' ) let spawned = spawn ( binPath , args ) spawned . stdout . on ( 'data' , data => stdout += data ) spawned . stderr . on ( 'data' , data => stderr += data ) spawned . on ( 'close' , ( ) => resolve ( [ stdout , stderr ] ) ) spawned . on ( 'error' , e => { throw ( e ) } ) if ( stdin ) { spawned . stdin . write ( stdin ) } spawned . stdin . end ( ) } ) }
run the simple-react-docgen script with optional stdin param
run the simple - react - docgen script with optional stdin param
// clean stdout and stderr outputs // return as promise to be used in tests // ensure script is runnable // when stdin is used