From 5e2a4278b03aeb01e0521f29e90caf5b184bd22a Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Thu, 14 Nov 2019 09:36:24 +0100 Subject: [PATCH] fix: put summary in `` Fixes #9 --- src/Reporter.tsx | 78 +++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 31 deletions(-) diff --git a/src/Reporter.tsx b/src/Reporter.tsx index efcfc9d..e1e08ed 100644 --- a/src/Reporter.tsx +++ b/src/Reporter.tsx @@ -82,31 +82,42 @@ const FailureMessage: React.FC<{ const CompletedTests: React.FC<{ completedTests: State['completedTests']; globalConfig: Config.GlobalConfig; -}> = ({ completedTests, globalConfig }) => { + summary: React.ReactElement; + PostMessage: () => React.ReactElement; + done: boolean; +}> = ({ completedTests, globalConfig, summary, PostMessage, done }) => { if (completedTests.length === 0) { return null; } const didUpdate = globalConfig.updateSnapshot === 'all'; + let testOutputs = completedTests.map(({ testResult, config }) => ( + + + + + + + )); + + if (done) { + testOutputs = testOutputs.concat( + + {summary} + , + + + , + ); + } + return ( - - {completedTests.map(({ testResult, config }) => ( - - - - - - - ))} - + {testOutputs} ); }; @@ -236,29 +247,34 @@ const Reporter: React.FC = ({ const { exit } = useApp(); React.useEffect(() => { if (done) { - exit(); + setImmediate(exit); } }, [done, exit]); + const summary = ( + + ); return ( - - ( + + )} /> - {done ? ( - - ) : null} + + {done ? null : summary} ); };