mirror of
https://github.com/pestphp/pest.git
synced 2026-04-22 23:17:28 +02:00
wip
This commit is contained in:
@ -9,8 +9,8 @@ use Pest\Exceptions\DatasetArgumentsMismatch;
|
|||||||
use Pest\Panic;
|
use Pest\Panic;
|
||||||
use Pest\Plugins\Tia;
|
use Pest\Plugins\Tia;
|
||||||
use Pest\Preset;
|
use Pest\Preset;
|
||||||
use Pest\Support\Container;
|
|
||||||
use Pest\Support\ChainableClosure;
|
use Pest\Support\ChainableClosure;
|
||||||
|
use Pest\Support\Container;
|
||||||
use Pest\Support\ExceptionTrace;
|
use Pest\Support\ExceptionTrace;
|
||||||
use Pest\Support\Reflection;
|
use Pest\Support\Reflection;
|
||||||
use Pest\Support\Shell;
|
use Pest\Support\Shell;
|
||||||
|
|||||||
@ -8,7 +8,6 @@ use NunoMaduro\Collision\Adapters\Phpunit\Printers\DefaultPrinter;
|
|||||||
use Pest\Contracts\Plugins\AddsOutput;
|
use Pest\Contracts\Plugins\AddsOutput;
|
||||||
use Pest\Contracts\Plugins\HandlesArguments;
|
use Pest\Contracts\Plugins\HandlesArguments;
|
||||||
use Pest\Contracts\Plugins\Terminable;
|
use Pest\Contracts\Plugins\Terminable;
|
||||||
use PHPUnit\Framework\TestStatus\TestStatus;
|
|
||||||
use Pest\Plugins\Tia\BaselineSync;
|
use Pest\Plugins\Tia\BaselineSync;
|
||||||
use Pest\Plugins\Tia\ChangedFiles;
|
use Pest\Plugins\Tia\ChangedFiles;
|
||||||
use Pest\Plugins\Tia\Contracts\State;
|
use Pest\Plugins\Tia\Contracts\State;
|
||||||
@ -20,6 +19,7 @@ use Pest\Plugins\Tia\ResultCollector;
|
|||||||
use Pest\Plugins\Tia\WatchPatterns;
|
use Pest\Plugins\Tia\WatchPatterns;
|
||||||
use Pest\Support\Container;
|
use Pest\Support\Container;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
|
use PHPUnit\Framework\TestStatus\TestStatus;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
@ -173,12 +173,12 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
*/
|
*/
|
||||||
private array $affectedFiles = [];
|
private array $affectedFiles = [];
|
||||||
|
|
||||||
private static function workerEdgesKey(string $token): string
|
private function workerEdgesKey(string $token): string
|
||||||
{
|
{
|
||||||
return self::KEY_WORKER_EDGES_PREFIX.$token.'.json';
|
return self::KEY_WORKER_EDGES_PREFIX.$token.'.json';
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function workerResultsKey(string $token): string
|
private function workerResultsKey(string $token): string
|
||||||
{
|
{
|
||||||
return self::KEY_WORKER_RESULTS_PREFIX.$token.'.json';
|
return self::KEY_WORKER_RESULTS_PREFIX.$token.'.json';
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
*/
|
*/
|
||||||
public function getCachedResult(string $filename, string $testId): ?TestStatus
|
public function getCachedResult(string $filename, string $testId): ?TestStatus
|
||||||
{
|
{
|
||||||
if ($this->replayGraph === null) {
|
if (! $this->replayGraph instanceof Graph) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
// branch (falls back to main if branch is fresh).
|
// branch (falls back to main if branch is fresh).
|
||||||
$result = $this->replayGraph->getResult($this->branch, $testId);
|
$result = $this->replayGraph->getResult($this->branch, $testId);
|
||||||
|
|
||||||
if ($result !== null) {
|
if ($result instanceof TestStatus) {
|
||||||
$this->replayedCount++;
|
$this->replayedCount++;
|
||||||
// Cache the assertion count alongside the status so `Testable`
|
// Cache the assertion count alongside the status so `Testable`
|
||||||
// can emit the exact `addToAssertionCount()` at replay time
|
// can emit the exact `addToAssertionCount()` at replay time
|
||||||
@ -351,7 +351,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
// the graph lands with results on first write — otherwise the next
|
// the graph lands with results on first write — otherwise the next
|
||||||
// run would load a graph with edges but empty results, miss the
|
// run would load a graph with edges but empty results, miss the
|
||||||
// cache for every test, and look pointlessly slow.
|
// cache for every test, and look pointlessly slow.
|
||||||
if (Parallel::isWorker() && ($this->replayGraph !== null || $this->recordingActive)) {
|
if (Parallel::isWorker() && ($this->replayGraph instanceof Graph || $this->recordingActive)) {
|
||||||
$this->flushWorkerReplay();
|
$this->flushWorkerReplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Parallel::isWorker()) {
|
if (Parallel::isWorker()) {
|
||||||
$this->flushWorkerPartial($projectRoot, $perTest);
|
$this->flushWorkerPartial($perTest);
|
||||||
$recorder->reset();
|
$recorder->reset();
|
||||||
$this->coverageCollector->reset();
|
$this->coverageCollector->reset();
|
||||||
|
|
||||||
@ -635,15 +635,12 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
// to pull a team-shared baseline so fresh checkouts (new devs, CI
|
// to pull a team-shared baseline so fresh checkouts (new devs, CI
|
||||||
// containers) don't pay the full record cost. If the pull succeeds
|
// containers) don't pay the full record cost. If the pull succeeds
|
||||||
// the graph is re-read and reconciled against the local env.
|
// the graph is re-read and reconciled against the local env.
|
||||||
if ($graph === null && ! $forceRebuild) {
|
if (! $graph instanceof Graph && ! $forceRebuild && $this->baselineSync->fetchIfAvailable($projectRoot)) {
|
||||||
if ($this->baselineSync->fetchIfAvailable($projectRoot)) {
|
|
||||||
$graph = $this->loadGraph($projectRoot);
|
$graph = $this->loadGraph($projectRoot);
|
||||||
|
|
||||||
if ($graph instanceof Graph) {
|
if ($graph instanceof Graph) {
|
||||||
$graph = $this->reconcileFingerprint($graph, $fingerprint);
|
$graph = $this->reconcileFingerprint($graph, $fingerprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Drop the marker so `Support\Coverage::report()` knows to merge the
|
// Drop the marker so `Support\Coverage::report()` knows to merge the
|
||||||
// current (narrow) coverage with the cached full-run snapshot. Plain
|
// current (narrow) coverage with the cached full-run snapshot. Plain
|
||||||
@ -657,14 +654,14 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
// report collapses to near-zero coverage. Fall back to recording
|
// report collapses to near-zero coverage. Fall back to recording
|
||||||
// (full suite) to seed the cache for next time.
|
// (full suite) to seed the cache for next time.
|
||||||
if ($this->piggybackCoverage && ! $this->state->exists(self::KEY_COVERAGE_CACHE)) {
|
if ($this->piggybackCoverage && ! $this->state->exists(self::KEY_COVERAGE_CACHE)) {
|
||||||
return $this->enterRecordMode($projectRoot, $arguments);
|
return $this->enterRecordMode($arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($graph instanceof Graph) {
|
if ($graph instanceof Graph) {
|
||||||
return $this->enterReplayMode($graph, $projectRoot, $arguments);
|
return $this->enterReplayMode($graph, $projectRoot, $arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->enterRecordMode($projectRoot, $arguments);
|
return $this->enterRecordMode($arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -792,7 +789,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parallel: persist affected set so workers can install the filter.
|
// Parallel: persist affected set so workers can install the filter.
|
||||||
if (! $this->persistAffectedSet($projectRoot, $affected)) {
|
if (! $this->persistAffectedSet($affected)) {
|
||||||
$this->output->writeln(
|
$this->output->writeln(
|
||||||
' <fg=red>TIA</> failed to persist affected set — running full suite.',
|
' <fg=red>TIA</> failed to persist affected set — running full suite.',
|
||||||
);
|
);
|
||||||
@ -802,7 +799,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
|
|
||||||
// Clear stale partials from a previous interrupted run so the merge
|
// Clear stale partials from a previous interrupted run so the merge
|
||||||
// pass doesn't pick up results from an unrelated invocation.
|
// pass doesn't pick up results from an unrelated invocation.
|
||||||
$this->purgeWorkerPartials($projectRoot);
|
$this->purgeWorkerPartials();
|
||||||
|
|
||||||
Parallel::setGlobal(self::REPLAYING_GLOBAL, '1');
|
Parallel::setGlobal(self::REPLAYING_GLOBAL, '1');
|
||||||
|
|
||||||
@ -812,7 +809,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
/**
|
/**
|
||||||
* @param array<int, string> $affected Project-relative paths.
|
* @param array<int, string> $affected Project-relative paths.
|
||||||
*/
|
*/
|
||||||
private function persistAffectedSet(string $projectRoot, array $affected): bool
|
private function persistAffectedSet(array $affected): bool
|
||||||
{
|
{
|
||||||
$json = json_encode(array_values($affected), JSON_UNESCAPED_SLASHES);
|
$json = json_encode(array_values($affected), JSON_UNESCAPED_SLASHES);
|
||||||
|
|
||||||
@ -827,7 +824,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
* @param array<int, string> $arguments
|
* @param array<int, string> $arguments
|
||||||
* @return array<int, string>
|
* @return array<int, string>
|
||||||
*/
|
*/
|
||||||
private function enterRecordMode(string $projectRoot, array $arguments): array
|
private function enterRecordMode(array $arguments): array
|
||||||
{
|
{
|
||||||
$recorder = $this->recorder;
|
$recorder = $this->recorder;
|
||||||
|
|
||||||
@ -852,7 +849,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
// recording. We only advertise the intent through a global.
|
// recording. We only advertise the intent through a global.
|
||||||
// Clean up any stale partial files from a previous interrupted
|
// Clean up any stale partial files from a previous interrupted
|
||||||
// run so the merge step doesn't confuse itself.
|
// run so the merge step doesn't confuse itself.
|
||||||
$this->purgeWorkerPartials($projectRoot);
|
$this->purgeWorkerPartials();
|
||||||
|
|
||||||
Parallel::setGlobal(self::RECORDING_GLOBAL, '1');
|
Parallel::setGlobal(self::RECORDING_GLOBAL, '1');
|
||||||
|
|
||||||
@ -907,7 +904,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
/**
|
/**
|
||||||
* @param array<string, array<int, string>> $perTest
|
* @param array<string, array<int, string>> $perTest
|
||||||
*/
|
*/
|
||||||
private function flushWorkerPartial(string $projectRoot, array $perTest): void
|
private function flushWorkerPartial(array $perTest): void
|
||||||
{
|
{
|
||||||
$json = json_encode($perTest, JSON_UNESCAPED_SLASHES);
|
$json = json_encode($perTest, JSON_UNESCAPED_SLASHES);
|
||||||
|
|
||||||
@ -915,7 +912,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->state->write(self::workerEdgesKey($this->workerToken()), $json);
|
$this->state->write($this->workerEdgesKey($this->workerToken()), $json);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -926,12 +923,11 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
return $this->state->keysWithPrefix(self::KEY_WORKER_EDGES_PREFIX);
|
return $this->state->keysWithPrefix(self::KEY_WORKER_EDGES_PREFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function purgeWorkerPartials(string $projectRoot): void
|
private function purgeWorkerPartials(): void
|
||||||
{
|
{
|
||||||
foreach ($this->collectWorkerEdgesPartials() as $key) {
|
foreach ($this->collectWorkerEdgesPartials() as $key) {
|
||||||
$this->state->delete($key);
|
$this->state->delete($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->collectWorkerReplayPartials() as $key) {
|
foreach ($this->collectWorkerReplayPartials() as $key) {
|
||||||
$this->state->delete($key);
|
$this->state->delete($key);
|
||||||
}
|
}
|
||||||
@ -963,7 +959,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->state->write(self::workerResultsKey($this->workerToken()), $json);
|
$this->state->write($this->workerResultsKey($this->workerToken()), $json);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1011,10 +1007,12 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
|
|
||||||
/** @var mixed $result */
|
/** @var mixed $result */
|
||||||
foreach ($decoded['results'] as $testId => $result) {
|
foreach ($decoded['results'] as $testId => $result) {
|
||||||
if (! is_string($testId) || ! is_array($result)) {
|
if (! is_string($testId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (! is_array($result)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$normalised[$testId] = [
|
$normalised[$testId] = [
|
||||||
'status' => is_int($result['status'] ?? null) ? $result['status'] : 0,
|
'status' => is_int($result['status'] ?? null) ? $result['status'] : 0,
|
||||||
'message' => is_string($result['message'] ?? null) ? $result['message'] : '',
|
'message' => is_string($result['message'] ?? null) ? $result['message'] : '',
|
||||||
@ -1119,7 +1117,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
$fragments[] = $this->replayedCount.' replayed';
|
$fragments[] = $this->replayedCount.' replayed';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fragments === [] ? '' : implode(', ', $fragments);
|
return implode(', ', $fragments);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ use Symfony\Component\Process\Process;
|
|||||||
*
|
*
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class BaselineSync
|
final readonly class BaselineSync
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Conventional workflow filename teams publish from. Not configurable
|
* Conventional workflow filename teams publish from. Not configurable
|
||||||
@ -63,8 +63,8 @@ final class BaselineSync
|
|||||||
private const string COVERAGE_ASSET = Tia::KEY_COVERAGE_CACHE;
|
private const string COVERAGE_ASSET = Tia::KEY_COVERAGE_CACHE;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly State $state,
|
private State $state,
|
||||||
private readonly OutputInterface $output,
|
private OutputInterface $output,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -46,7 +46,7 @@ final class CoverageMerger
|
|||||||
{
|
{
|
||||||
$state = self::state();
|
$state = self::state();
|
||||||
|
|
||||||
if ($state === null || ! $state->exists(Tia::KEY_COVERAGE_MARKER)) {
|
if (! $state instanceof State || ! $state->exists(Tia::KEY_COVERAGE_MARKER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ final class CoverageMerger
|
|||||||
// verbatim (as serialised bytes) for next time.
|
// verbatim (as serialised bytes) for next time.
|
||||||
$current = self::requireCoverage($reportPath);
|
$current = self::requireCoverage($reportPath);
|
||||||
|
|
||||||
if ($current !== null) {
|
if ($current instanceof CodeCoverage) {
|
||||||
$state->write(Tia::KEY_COVERAGE_CACHE, serialize($current));
|
$state->write(Tia::KEY_COVERAGE_CACHE, serialize($current));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ final class CoverageMerger
|
|||||||
$cached = self::unserializeCoverage($cachedBytes);
|
$cached = self::unserializeCoverage($cachedBytes);
|
||||||
$current = self::requireCoverage($reportPath);
|
$current = self::requireCoverage($reportPath);
|
||||||
|
|
||||||
if ($cached === null || $current === null) {
|
if (! $cached instanceof CodeCoverage || ! $current instanceof CodeCoverage) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ final class CoverageMerger
|
|||||||
// can `require` it, and to the state cache for the next run.
|
// can `require` it, and to the state cache for the next run.
|
||||||
@file_put_contents(
|
@file_put_contents(
|
||||||
$reportPath,
|
$reportPath,
|
||||||
"<?php return unserialize(".var_export($serialised, true).");\n",
|
'<?php return unserialize('.var_export($serialised, true).");\n",
|
||||||
);
|
);
|
||||||
$state->write(Tia::KEY_COVERAGE_CACHE, $serialised);
|
$state->write(Tia::KEY_COVERAGE_CACHE, $serialised);
|
||||||
}
|
}
|
||||||
@ -108,10 +108,12 @@ final class CoverageMerger
|
|||||||
|
|
||||||
foreach ($lineCoverage as $file => $lines) {
|
foreach ($lineCoverage as $file => $lines) {
|
||||||
foreach ($lines as $line => $ids) {
|
foreach ($lines as $line => $ids) {
|
||||||
if ($ids === null || $ids === []) {
|
if ($ids === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($ids === []) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filtered = array_values(array_diff($ids, $currentIds));
|
$filtered = array_values(array_diff($ids, $currentIds));
|
||||||
|
|
||||||
if ($filtered !== $ids) {
|
if ($filtered !== $ids) {
|
||||||
@ -175,7 +177,6 @@ final class CoverageMerger
|
|||||||
private static function unserializeCoverage(string $bytes): ?CodeCoverage
|
private static function unserializeCoverage(string $bytes): ?CodeCoverage
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
/** @var mixed $value */
|
|
||||||
$value = @unserialize($bytes);
|
$value = @unserialize($bytes);
|
||||||
} catch (Throwable) {
|
} catch (Throwable) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -17,14 +17,14 @@ use Pest\Plugins\Tia\Contracts\State;
|
|||||||
*
|
*
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class FileState implements State
|
final readonly class FileState implements State
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Configured root. May not exist on disk yet; resolved + created on
|
* Configured root. May not exist on disk yet; resolved + created on
|
||||||
* the first write. Keeping the raw string lets the instance be built
|
* the first write. Keeping the raw string lets the instance be built
|
||||||
* before Pest's temp dir has been materialised.
|
* before Pest's temp dir has been materialised.
|
||||||
*/
|
*/
|
||||||
private readonly string $rootDir;
|
private string $rootDir;
|
||||||
|
|
||||||
public function __construct(string $rootDir)
|
public function __construct(string $rootDir)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,9 +16,9 @@ use PHPUnit\Event\Test\FinishedSubscriber;
|
|||||||
*
|
*
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class EnsureTiaAssertionsAreRecordedOnFinished implements FinishedSubscriber
|
final readonly class EnsureTiaAssertionsAreRecordedOnFinished implements FinishedSubscriber
|
||||||
{
|
{
|
||||||
public function __construct(private readonly ResultCollector $collector) {}
|
public function __construct(private ResultCollector $collector) {}
|
||||||
|
|
||||||
public function notify(Finished $event): void
|
public function notify(Finished $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,9 +11,9 @@ use PHPUnit\Event\Test\ErroredSubscriber;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class EnsureTiaResultIsRecordedOnErrored implements ErroredSubscriber
|
final readonly class EnsureTiaResultIsRecordedOnErrored implements ErroredSubscriber
|
||||||
{
|
{
|
||||||
public function __construct(private readonly ResultCollector $collector) {}
|
public function __construct(private ResultCollector $collector) {}
|
||||||
|
|
||||||
public function notify(Errored $event): void
|
public function notify(Errored $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,9 +11,9 @@ use PHPUnit\Event\Test\FailedSubscriber;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class EnsureTiaResultIsRecordedOnFailed implements FailedSubscriber
|
final readonly class EnsureTiaResultIsRecordedOnFailed implements FailedSubscriber
|
||||||
{
|
{
|
||||||
public function __construct(private readonly ResultCollector $collector) {}
|
public function __construct(private ResultCollector $collector) {}
|
||||||
|
|
||||||
public function notify(Failed $event): void
|
public function notify(Failed $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,9 +11,9 @@ use PHPUnit\Event\Test\MarkedIncompleteSubscriber;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class EnsureTiaResultIsRecordedOnIncomplete implements MarkedIncompleteSubscriber
|
final readonly class EnsureTiaResultIsRecordedOnIncomplete implements MarkedIncompleteSubscriber
|
||||||
{
|
{
|
||||||
public function __construct(private readonly ResultCollector $collector) {}
|
public function __construct(private ResultCollector $collector) {}
|
||||||
|
|
||||||
public function notify(MarkedIncomplete $event): void
|
public function notify(MarkedIncomplete $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,9 +11,9 @@ use PHPUnit\Event\Test\PassedSubscriber;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class EnsureTiaResultIsRecordedOnPassed implements PassedSubscriber
|
final readonly class EnsureTiaResultIsRecordedOnPassed implements PassedSubscriber
|
||||||
{
|
{
|
||||||
public function __construct(private readonly ResultCollector $collector) {}
|
public function __construct(private ResultCollector $collector) {}
|
||||||
|
|
||||||
public function notify(Passed $event): void
|
public function notify(Passed $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,9 +11,9 @@ use PHPUnit\Event\Test\ConsideredRiskySubscriber;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class EnsureTiaResultIsRecordedOnRisky implements ConsideredRiskySubscriber
|
final readonly class EnsureTiaResultIsRecordedOnRisky implements ConsideredRiskySubscriber
|
||||||
{
|
{
|
||||||
public function __construct(private readonly ResultCollector $collector) {}
|
public function __construct(private ResultCollector $collector) {}
|
||||||
|
|
||||||
public function notify(ConsideredRisky $event): void
|
public function notify(ConsideredRisky $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,9 +11,9 @@ use PHPUnit\Event\Test\SkippedSubscriber;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class EnsureTiaResultIsRecordedOnSkipped implements SkippedSubscriber
|
final readonly class EnsureTiaResultIsRecordedOnSkipped implements SkippedSubscriber
|
||||||
{
|
{
|
||||||
public function __construct(private readonly ResultCollector $collector) {}
|
public function __construct(private ResultCollector $collector) {}
|
||||||
|
|
||||||
public function notify(Skipped $event): void
|
public function notify(Skipped $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -20,9 +20,9 @@ use PHPUnit\Event\Test\PreparedSubscriber;
|
|||||||
*
|
*
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class EnsureTiaResultsAreCollected implements PreparedSubscriber
|
final readonly class EnsureTiaResultsAreCollected implements PreparedSubscriber
|
||||||
{
|
{
|
||||||
public function __construct(private readonly ResultCollector $collector) {}
|
public function __construct(private ResultCollector $collector) {}
|
||||||
|
|
||||||
public function notify(Prepared $event): void
|
public function notify(Prepared $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Pest\Support;
|
namespace Pest\Support;
|
||||||
|
|
||||||
use Pest\Exceptions\ShouldNotHappen;
|
use Pest\Exceptions\ShouldNotHappen;
|
||||||
|
use Pest\Plugins\Tia\CoverageMerger;
|
||||||
use SebastianBergmann\CodeCoverage\CodeCoverage;
|
use SebastianBergmann\CodeCoverage\CodeCoverage;
|
||||||
use SebastianBergmann\CodeCoverage\Node\Directory;
|
use SebastianBergmann\CodeCoverage\Node\Directory;
|
||||||
use SebastianBergmann\CodeCoverage\Node\File;
|
use SebastianBergmann\CodeCoverage\Node\File;
|
||||||
@ -92,7 +93,7 @@ final class Coverage
|
|||||||
// tests. Merge their fresh coverage slice into the cached full-run
|
// tests. Merge their fresh coverage slice into the cached full-run
|
||||||
// snapshot (stored by the previous `--tia --coverage` pass) so the
|
// snapshot (stored by the previous `--tia --coverage` pass) so the
|
||||||
// report reflects the entire suite, not just what re-ran.
|
// report reflects the entire suite, not just what re-ran.
|
||||||
\Pest\Plugins\Tia\CoverageMerger::applyIfMarked($reportPath);
|
CoverageMerger::applyIfMarked($reportPath);
|
||||||
|
|
||||||
/** @var CodeCoverage $codeCoverage */
|
/** @var CodeCoverage $codeCoverage */
|
||||||
$codeCoverage = require $reportPath;
|
$codeCoverage = require $reportPath;
|
||||||
|
|||||||
Reference in New Issue
Block a user