@@ -83,35 +83,43 @@ const FailureMessage: React.FC<{
83
83
const CompletedTests : React . FC < {
84
84
completedTests : State [ 'completedTests' ] ;
85
85
globalConfig : Config . GlobalConfig ;
86
- } > = ( { completedTests, globalConfig } ) => {
86
+ summary : React . ReactElement ;
87
+ PostMessage : ( ) => React . ReactElement ;
88
+ done : boolean ;
89
+ } > = ( { completedTests, globalConfig, summary, PostMessage, done } ) => {
87
90
if ( completedTests . length === 0 ) {
88
91
return null ;
89
92
}
90
93
const didUpdate = globalConfig . updateSnapshot === 'all' ;
91
94
95
+ let testOutputs = completedTests . map ( ( { testResult, config } ) => (
96
+ < React . Fragment key = { testResult . testFilePath + config . name } >
97
+ < ResultHeader config = { config } testResult = { testResult } />
98
+ < VerboseTestList testResult = { testResult } globalConfig = { globalConfig } />
99
+ < TestConsoleOutput
100
+ console = { testResult . console }
101
+ verbose = { globalConfig . verbose }
102
+ cwd = { config . cwd }
103
+ />
104
+ < FailureMessage failureMessage = { testResult . failureMessage } />
105
+ < SnapshotStatus snapshot = { testResult . snapshot } afterUpdate = { didUpdate } />
106
+ </ React . Fragment >
107
+ ) ) ;
108
+
109
+ if ( done ) {
110
+ testOutputs = testOutputs . concat (
111
+ < Box paddingTop = { 1 } key = "summary" >
112
+ { summary }
113
+ </ Box > ,
114
+ < React . Fragment key = "postmessage" >
115
+ < PostMessage />
116
+ </ React . Fragment > ,
117
+ ) ;
118
+ }
119
+
92
120
return (
93
121
< 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
99
- testResult = { testResult }
100
- globalConfig = { globalConfig }
101
- />
102
- < 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 >
122
+ < Static > { testOutputs } </ Static >
115
123
</ Box >
116
124
) ;
117
125
} ;
@@ -241,29 +249,34 @@ const Reporter: React.FC<Props> = ({
241
249
const { exit } = useApp ( ) ;
242
250
React . useEffect ( ( ) => {
243
251
if ( done ) {
244
- exit ( ) ;
252
+ setImmediate ( exit ) ;
245
253
}
246
254
} , [ done , exit ] ) ;
247
255
256
+ const summary = (
257
+ < Summary
258
+ aggregatedResults = { aggregatedResults }
259
+ options = { { estimatedTime, roundTime : true , width } }
260
+ done = { done }
261
+ />
262
+ ) ;
248
263
return (
249
264
< Box flexDirection = "column" >
250
265
< CompletedTests
251
266
completedTests = { completedTests }
252
267
globalConfig = { globalConfig }
253
- />
254
- < RunningTests tests = { currentTests } width = { width } />
255
- < Summary
256
- aggregatedResults = { aggregatedResults }
257
- options = { { estimatedTime, roundTime : true , width } }
268
+ summary = { summary }
258
269
done = { done }
270
+ PostMessage = { ( ) => (
271
+ < PostMessage
272
+ aggregatedResults = { aggregatedResults }
273
+ globalConfig = { globalConfig }
274
+ contexts = { contexts }
275
+ />
276
+ ) }
259
277
/>
260
- { done ? (
261
- < PostMessage
262
- aggregatedResults = { aggregatedResults }
263
- globalConfig = { globalConfig }
264
- contexts = { contexts }
265
- />
266
- ) : null }
278
+ < RunningTests tests = { currentTests } width = { width } />
279
+ { done ? null : summary }
267
280
</ Box >
268
281
) ;
269
282
} ;
0 commit comments