mirror of
https://github.com/pestphp/pest.git
synced 2026-12-03 22:45:06 +01:00
fix(tia): drop the results of every branch on environment drift (#2011)
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ceef9806c2
commit
0224b4238b
+1
-1
@@ -835,7 +835,7 @@ final class Tia implements AddsOutput, HandlesArguments, HandlesOriginalArgument
|
||||
implode(', ', $drift),
|
||||
));
|
||||
|
||||
$graph->clearResults($this->branch);
|
||||
$graph->clearResults();
|
||||
$graph->setFingerprint($current);
|
||||
$this->saveGraph($graph);
|
||||
$this->deleteState(self::KEY_COVERAGE_CACHE);
|
||||
|
||||
@@ -943,10 +943,11 @@ final class Graph
|
||||
$this->baselines[$branch]['tree'] = $tree;
|
||||
}
|
||||
|
||||
public function clearResults(string $branch): void
|
||||
public function clearResults(): void
|
||||
{
|
||||
$this->ensureBaseline($branch);
|
||||
$this->baselines[$branch]['results'] = [];
|
||||
foreach (array_keys($this->baselines) as $branch) {
|
||||
$this->baselines[$branch]['results'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1943,6 +1943,7 @@
|
||||
✓ markKnownTestFiles() → it makes a test file with no edges known
|
||||
✓ markKnownTestFiles() → it does not clobber edges of an already-known test file
|
||||
✓ markKnownTestFiles() → it ignores paths outside the project root
|
||||
✓ clearResults() → it drops the results of the fallback branch too
|
||||
|
||||
PASS Tests\Unit\Plugins\Tia\IsEnabledForRun
|
||||
✓ does not throw when an integer --random-order-seed is passed as a separate argv element
|
||||
@@ -2293,4 +2294,4 @@
|
||||
✓ pass with dataset with ('my-datas-set-value')
|
||||
✓ within describe → pass with dataset with ('my-datas-set-value')
|
||||
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 36 skipped, 1625 passed (3589 assertions)
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 36 skipped, 1626 passed (3592 assertions)
|
||||
|
||||
@@ -312,3 +312,17 @@ describe('markKnownTestFiles()', function (): void {
|
||||
expect($graph->knowsTest('/somewhere/else/tests/FooTest.php'))->toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe('clearResults()', function (): void {
|
||||
it('drops the results of the fallback branch too', function (): void {
|
||||
$graph = new Graph(sys_get_temp_dir());
|
||||
$graph->setResult('main', 'Tests\FooTest::it passes', 0, '', 0.1, 1);
|
||||
$graph->setResult('feature', 'Tests\BarTest::it passes', 0, '', 0.1, 1);
|
||||
|
||||
$graph->clearResults();
|
||||
|
||||
expect($graph->getResult('feature', 'Tests\FooTest::it passes'))->toBeNull()
|
||||
->and($graph->getResult('feature', 'Tests\BarTest::it passes'))->toBeNull()
|
||||
->and($graph->getResult('main', 'Tests\FooTest::it passes'))->toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ test('parallel', function () use ($run): void {
|
||||
$output = $run('--exclude-group=integration');
|
||||
$output = implode("\n", array_slice(explode("\n", (string) $output), -10));
|
||||
|
||||
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 28 skipped, 1606 passed (3531 assertions)';
|
||||
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 28 skipped, 1607 passed (3534 assertions)';
|
||||
|
||||
expect($output)
|
||||
->toContain("Tests: {$expected}")
|
||||
|
||||
Reference in New Issue
Block a user