protected async function writeProgressImplAsync()

in src/_Private/VerboseCLIOutput.hack [22:74]


  protected async function writeProgressImplAsync(
    <<__AcceptDisposable>> IO\WriteHandle $handle,
    HackTest\ProgressEvent $e,
  ): Awaitable<void> {
    if ($e is HackTest\TestRunFinishedProgressEvent) {
      await $this->writeFailureDetailsAsync($handle);
      await $this->writeSummaryAsync($handle);
      return;
    }

    if ($e is HackTest\TestFinishedProgressEvent) {
      switch ($e->getResult()) {
        case TestResult::PASSED:
          await $handle->writeAllAsync("PASS\n");
          break;
        case TestResult::SKIPPED:
          await $handle->writeAllAsync("SKIP\n");
          break;
        case TestResult::FAILED:
          await $handle->writeAllAsync("FAIL\n");
          break;
        case TestResult::ERROR:
          await $handle->writeAllAsync("ERROR\n");
          break;
      }
    }

    if ($e is HackTest\InvokingDataProvidersProgressEvent) {
      $message = 'calling data providers...';
    } else if ($e is HackTest\TestStartingProgressEvent) {
      $message = 'starting...';
    } else if ($e is HackTest\TestFinishedProgressEvent) {
      $message = '...complete.';
    } else {
      return;
    }

    if ($e is HackTest\TestProgressEvent) {
      $scope = '  ::'.$e->getTestMethod();
      if ($e is HackTest\TestInstanceProgressEvent) {
        $dp = $e->getDataProviderRow();
        if ($dp is nonnull) {
          $scope .= '['.(string)$dp[0].']';
        }
      }
    } else if ($e is HackTest\ClassProgressEvent) {
      $scope = $e->getClassname();
    } else {
      $scope = $e->getPath();
    }

    await $handle->writeAllAsync($scope.'> '.$message."\n");
  }