@@ -83,35 +83,43 @@ 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
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+
92120 return (
93121 < 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 >
115123 </ Box >
116124 ) ;
117125} ;
@@ -241,29 +249,34 @@ const Reporter: React.FC<Props> = ({
241249 const { exit } = useApp ( ) ;
242250 React . useEffect ( ( ) => {
243251 if ( done ) {
244- exit ( ) ;
252+ setImmediate ( exit ) ;
245253 }
246254 } , [ done , exit ] ) ;
247255
256+ const summary = (
257+ < Summary
258+ aggregatedResults = { aggregatedResults }
259+ options = { { estimatedTime, roundTime : true , width } }
260+ done = { done }
261+ />
262+ ) ;
248263 return (
249264 < Box flexDirection = "column" >
250265 < CompletedTests
251266 completedTests = { completedTests }
252267 globalConfig = { globalConfig }
253- />
254- < RunningTests tests = { currentTests } width = { width } />
255- < Summary
256- aggregatedResults = { aggregatedResults }
257- options = { { estimatedTime, roundTime : true , width } }
268+ summary = { summary }
258269 done = { done }
270+ PostMessage = { ( ) => (
271+ < PostMessage
272+ aggregatedResults = { aggregatedResults }
273+ globalConfig = { globalConfig }
274+ contexts = { contexts }
275+ />
276+ ) }
259277 />
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 }
267280 </ Box >
268281 ) ;
269282} ;
0 commit comments