@@ -83,35 +83,46 @@ 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
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
99
99
testResult = { testResult }
100
100
globalConfig = { globalConfig }
101
101
/>
102
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 >
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 >
115
126
</ Box >
116
127
) ;
117
128
} ;
@@ -241,29 +252,34 @@ const Reporter: React.FC<Props> = ({
241
252
const { exit } = useApp ( ) ;
242
253
React . useEffect ( ( ) => {
243
254
if ( done ) {
244
- exit ( ) ;
255
+ setImmediate ( exit ) ;
245
256
}
246
257
} , [ done , exit ] ) ;
247
258
259
+ const summary = (
260
+ < Summary
261
+ aggregatedResults = { aggregatedResults }
262
+ options = { { estimatedTime, roundTime : true , width } }
263
+ done = { done }
264
+ />
265
+ ) ;
248
266
return (
249
267
< Box flexDirection = "column" >
250
268
< CompletedTests
251
269
completedTests = { completedTests }
252
270
globalConfig = { globalConfig }
253
- />
254
- < RunningTests tests = { currentTests } width = { width } />
255
- < Summary
256
- aggregatedResults = { aggregatedResults }
257
- options = { { estimatedTime, roundTime : true , width } }
271
+ summary = { summary }
258
272
done = { done }
273
+ PostMessage = { ( ) => (
274
+ < PostMessage
275
+ aggregatedResults = { aggregatedResults }
276
+ globalConfig = { globalConfig }
277
+ contexts = { contexts }
278
+ />
279
+ ) }
259
280
/>
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 }
267
283
</ Box >
268
284
) ;
269
285
} ;
0 commit comments