Exemple #1
0
      onComplete: results => {
        isRunning = false;
        hasSnapshotFailure = !!results.snapshot.failure;
        failedSnapshotTestPaths = getFailedSnapshotTests(results);

        // Create a new testWatcher instance so that re-runs won't be blocked.
        // The old instance that was passed to Jest will still be interrupted
        // and prevent test runs from the previous run.
        testWatcher = new TestWatcher({isWatchMode: true});

        testNamePatternPrompt.updateCachedTestResults(results.testResults);

        // Do not show any Watch Usage related stuff when running in a
        // non-interactive environment
        if (isInteractive) {
          if (snapshotInteractiveMode.isActive()) {
            snapshotInteractiveMode.updateWithResults(results);
            return;
          }
          if (shouldDisplayWatchUsage) {
            outputStream.write(
              usage(globalConfig, watchPlugins, hasSnapshotFailure),
            );
            shouldDisplayWatchUsage = false; // hide Watch Usage after first run
            isWatchUsageDisplayed = true;
          } else {
            outputStream.write(showToggleUsagePrompt());
            shouldDisplayWatchUsage = false;
            isWatchUsageDisplayed = false;
          }
        } else {
          outputStream.write('\n');
        }
        failedTestsCache.setTestResults(results.testResults);
        testNamePatternPrompt.updateCachedTestResults(results.testResults);
      },
 hooks.testRunComplete(results => {
   this._failedSnapshotTestPaths = getFailedSnapshotTests(results);
   if (this._snapshotInteractiveMode.isActive()) {
     this._snapshotInteractiveMode.updateWithResults(results);
   }
 });