11import childProcess from 'child_process'
2+ import { performance } from 'perf_hooks'
23import stripFinalNewline from 'strip-final-newline'
34import { RenderOptions , RenderResult , TestInstance } from '../types/pure'
45import { _runObservers } from './mutation-observer'
@@ -8,7 +9,6 @@ import {bindObjectFnsToInstance, setCurrentInstance} from './helpers'
89import { fireEvent } from './events'
910import { getConfig } from './config'
1011import { logCLI } from './pretty-cli'
11- import { performance } from 'perf_hooks'
1212
1313const mountedInstances = new Set < TestInstance > ( )
1414
@@ -48,8 +48,8 @@ async function render(
4848 } ,
4949 // An array of strings gathered from stdout when unable to do
5050 // `await stdout` because of inquirer interactive prompts
51- stdoutArr : [ ] as Array < { contents : Buffer | string , timestamp : number } > ,
52- stderrArr : [ ] as Array < { contents : Buffer | string , timestamp : number } > ,
51+ stdoutArr : [ ] as Array < { contents : Buffer | string ; timestamp : number } > ,
52+ stderrArr : [ ] as Array < { contents : Buffer | string ; timestamp : number } > ,
5353 hasExit ( ) {
5454 return this . __exitCode === null ? null : { exitCode : this . __exitCode }
5555 } ,
@@ -66,7 +66,10 @@ async function render(
6666 }
6767
6868 const resStr = stripFinalNewline ( result as string )
69- execOutputAPI . stdoutArr . push ( { contents : resStr , timestamp : performance . now ( ) } )
69+ execOutputAPI . stdoutArr . push ( {
70+ contents : resStr ,
71+ timestamp : performance . now ( ) ,
72+ } )
7073 _runObservers ( )
7174 } )
7275
@@ -77,7 +80,10 @@ async function render(
7780 }
7881
7982 const resStr = stripFinalNewline ( result as string )
80- execOutputAPI . stderrArr . push ( { contents : resStr , timestamp : performance . now ( ) } )
83+ execOutputAPI . stderrArr . push ( {
84+ contents : resStr ,
85+ timestamp : performance . now ( ) ,
86+ } )
8187 _runObservers ( )
8288 } )
8389
@@ -104,12 +110,12 @@ async function render(
104110
105111 await execOutputAPI . _isReady
106112
107-
108113 function getStdallStr ( this : Omit < TestInstance , 'getStdallStr' > ) {
109- return this . stderrArr . concat ( this . stdoutArr )
110- . sort ( ( a , b ) => a . timestamp < b . timestamp ? - 1 : 1 )
111- . map ( obj => obj . contents )
112- . join ( '\n' ) ;
114+ return this . stderrArr
115+ . concat ( this . stdoutArr )
116+ . sort ( ( a , b ) => ( a . timestamp < b . timestamp ? - 1 : 1 ) )
117+ . map ( obj => obj . contents )
118+ . join ( '\n' )
113119 }
114120
115121 return Object . assign (
0 commit comments