diff --git a/src/Reporter.tsx b/src/Reporter.tsx
index df93daf..69d3951 100644
--- a/src/Reporter.tsx
+++ b/src/Reporter.tsx
@@ -89,35 +89,43 @@ 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 (
-
- {({ testResult, config }) => (
-
-
-
-
-
-
-
- )}
-
+ {ele => ele}
);
};
@@ -214,6 +222,27 @@ const RunningTests: React.FC<{
);
};
+const Exiter: React.FC<{ done: boolean }> = ({ done }) => {
+ const { exit } = useApp();
+
+ const [shouldExit, setShouldExit] = React.useState(false);
+
+ // use a separate effect to ensure output is properly flushed. This _might_ be a bug in Ink, not sure
+ React.useEffect(() => {
+ if (done) {
+ setShouldExit(true);
+ }
+ }, [done, exit]);
+
+ React.useEffect(() => {
+ if (shouldExit) {
+ exit();
+ }
+ }, [exit, shouldExit]);
+
+ return null;
+};
+
const Reporter: React.FC = ({
register,
globalConfig,
@@ -239,32 +268,31 @@ const Reporter: React.FC = ({
state;
const { estimatedTime = 0 } = options;
- const { exit } = useApp();
- React.useEffect(() => {
- if (done) {
- exit();
- }
- }, [done, exit]);
-
+ const summary = (
+
+ );
return (
-
- (
+
+ )}
/>
- {done ? (
-
- ) : null}
+
+ {done ? null : summary}
+
);
};