From c7ad09413efcf7905c51f4d1c861c383aa45eeaf Mon Sep 17 00:00:00 2001 From: Greg Veres Date: Mon, 18 May 2020 06:58:32 -0400 Subject: [PATCH] 193 better indication test run status (#198) * changed summary to only animate when updating When in watch mode, the summary background used to animate all the time. This meant that it was difficult to understand if the test was currently running or if the results you were looking at were the result of the latest test run. With this change the background only animates when a test is actually in progress. If you are in watch mode, the play button turns to a stop button and the background is not animated, But when Jest is running, the background is animating. When jest finishes, the background stops. This addresses issue #193 * fixed merge error cherry picking the commit brought in part of another change. this undoes that other change and puts the removed code back. Co-authored-by: Greg Veres --- ui/test-file/index.tsx | 3 +++ ui/test-file/summary/index.tsx | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/test-file/index.tsx b/ui/test-file/index.tsx index 9a945eb..1cecb79 100644 --- a/ui/test-file/index.tsx +++ b/ui/test-file/index.tsx @@ -89,6 +89,8 @@ function TestFile({ selectedFilePath, isRunning, projectRoot, onStop }: Props) { result => result.changeToResult ); + const isUpdating = isRunning && (result === null ||(result.numPassingTests === 0 && result.numFailingTests === 0)); + const haveSnapshotFailures = ((result && result.testResults) || []).some( testResult => { return (testResult.failureMessages || []).some(failureMessage => @@ -115,6 +117,7 @@ function TestFile({ selectedFilePath, isRunning, projectRoot, onStop }: Props) { failingTests={result && result.numFailingTests} path={selectedFilePath} isRunning={isRunning} + isUpdating={isUpdating} isLoadingResult={loading} haveSnapshotFailures={haveSnapshotFailures} onRun={() => { diff --git a/ui/test-file/summary/index.tsx b/ui/test-file/summary/index.tsx index 1378b48..3badfa3 100644 --- a/ui/test-file/summary/index.tsx +++ b/ui/test-file/summary/index.tsx @@ -108,6 +108,7 @@ interface Props { passingTests: number; failingTests: number; isRunning: boolean; + isUpdating: boolean; isLoadingResult: boolean; onRun: () => void; onStop: () => void; @@ -124,6 +125,7 @@ export default function FileSummary({ passingTests, failingTests, isRunning, + isUpdating, isLoadingResult, onRun, onStop, @@ -140,7 +142,7 @@ export default function FileSummary({ return ( - {(isRunning || isLoadingResult) && } + {( isUpdating || isLoadingResult) && } {path.replace(projectRoot, "")}