in src/HackTestCLI.hack [86:119]
public async function mainAsync(): Awaitable<int> {
$cf = $this->classFilter;
$mf = $this->methodFilter;
$output = $this->verbose
? new _Private\VerboseCLIOutput($this->getTerminal())
: new _Private\ConciseCLIOutput($this->getTerminal());
$stdout = $this->getStdout();
await HackTestRunner::runAsync(
$this->getArguments(),
shape(
'classes' => (
$cf === null ? ($_ ==> true) : ($c ==> \fnmatch($cf, $c))
),
'methods' => ($mf ?? ($_class, $_method) ==> true),
),
async $event ==> await $output->writeProgressAsync($stdout, $event),
);
$result_counts = $output->getResultCounts();
if (Math\sum($result_counts) === 0) {
await $this->getStderr()->writeAllAsync("No tests found.\n");
return ExitCode::ERROR;
}
if (($result_counts[TestResult::ERROR] ?? 0) > 0) {
return ExitCode::ERROR;
}
if (($result_counts[TestResult::FAILED] ?? 0) > 0) {
return ExitCode::FAILURE;
}
return ExitCode::SUCCESS;
}