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