@@ -83,35 +83,46 @@ const FailureMessage: React.FC<{
8383const CompletedTests : React . FC < {
8484 completedTests : State [ 'completedTests' ] ;
8585 globalConfig : Config . GlobalConfig ;
86- } > = ( { completedTests, globalConfig } ) => {
86+ summary : React . ReactElement ;
87+ PostMessage : ( ) => React . ReactElement ;
88+ done : boolean ;
89+ } > = ( { completedTests, globalConfig, summary, PostMessage, done } ) => {
8790 if ( completedTests . length === 0 ) {
8891 return null ;
8992 }
9093 const didUpdate = globalConfig . updateSnapshot === 'all' ;
9194
92- return (
93- < Box paddingBottom = { 1 } flexDirection = "column" >
94- < Static >
95- { completedTests . map ( ( { testResult, config } ) => (
96- < React . Fragment key = { testResult . testFilePath + config . name } >
97- < ResultHeader config = { config } testResult = { testResult } />
98- < VerboseTestList
95+ let testOutputs = completedTests . map ( ( { testResult, config } ) => (
96+ < React . Fragment key = { testResult . testFilePath + config . name } >
97+ < ResultHeader config = { config } testResult = { testResult } />
98+ < VerboseTestList
9999 testResult = { testResult }
100100 globalConfig = { globalConfig }
101101 />
102102 < TestConsoleOutput
103- console = { testResult . console }
104- verbose = { globalConfig . verbose }
105- cwd = { config . cwd }
106- />
107- < FailureMessage failureMessage = { testResult . failureMessage } />
108- < SnapshotStatus
109- snapshot = { testResult . snapshot }
110- afterUpdate = { didUpdate }
111- />
112- </ React . Fragment >
113- ) ) }
114- </ Static >
103+ console = { testResult . console }
104+ verbose = { globalConfig . verbose }
105+ cwd = { config . cwd }
106+ />
107+ < FailureMessage failureMessage = { testResult . failureMessage } />
108+ < SnapshotStatus snapshot = { testResult . snapshot } afterUpdate = { didUpdate } />
109+ </ React . Fragment >
110+ ) ) ;
111+
112+ if ( done ) {
113+ testOutputs = testOutputs . concat (
114+ < Box paddingTop = { 1 } key = "summary" >
115+ { summary }
116+ </ Box > ,
117+ < React . Fragment key = "postmessage" >
118+ < PostMessage />
119+ </ React . Fragment > ,
120+ ) ;
121+ }
122+
123+ return (
124+ < Box paddingBottom = { 1 } flexDirection = "column" >
125+ < Static > { testOutputs } </ Static >
115126 </ Box >
116127 ) ;
117128} ;
@@ -241,29 +252,34 @@ const Reporter: React.FC<Props> = ({
241252 const { exit } = useApp ( ) ;
242253 React . useEffect ( ( ) => {
243254 if ( done ) {
244- exit ( ) ;
255+ setImmediate ( exit ) ;
245256 }
246257 } , [ done , exit ] ) ;
247258
259+ const summary = (
260+ < Summary
261+ aggregatedResults = { aggregatedResults }
262+ options = { { estimatedTime, roundTime : true , width } }
263+ done = { done }
264+ />
265+ ) ;
248266 return (
249267 < Box flexDirection = "column" >
250268 < CompletedTests
251269 completedTests = { completedTests }
252270 globalConfig = { globalConfig }
253- />
254- < RunningTests tests = { currentTests } width = { width } />
255- < Summary
256- aggregatedResults = { aggregatedResults }
257- options = { { estimatedTime, roundTime : true , width } }
271+ summary = { summary }
258272 done = { done }
273+ PostMessage = { ( ) => (
274+ < PostMessage
275+ aggregatedResults = { aggregatedResults }
276+ globalConfig = { globalConfig }
277+ contexts = { contexts }
278+ />
279+ ) }
259280 />
260- { done ? (
261- < PostMessage
262- aggregatedResults = { aggregatedResults }
263- globalConfig = { globalConfig }
264- contexts = { contexts }
265- />
266- ) : null }
281+ < RunningTests tests = { currentTests } width = { width } />
282+ { done ? null : summary }
267283 </ Box >
268284 ) ;
269285} ;
0 commit comments