diff --git a/src/Concerns/Testable.php b/src/Concerns/Testable.php index 8d5b5eed..72bf02bb 100644 --- a/src/Concerns/Testable.php +++ b/src/Concerns/Testable.php @@ -304,12 +304,4 @@ trait Testable { return ltrim(self::class, 'P\\'); } - - /** - * Determine whether this test case is being executed in a parallel environment. - */ - public function isInParallel(): bool - { - return TestSuite::getInstance()->isInParallel; - } } diff --git a/src/TestSuite.php b/src/TestSuite.php index 320b6804..f2b5ccde 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -73,13 +73,6 @@ final class TestSuite */ public $testPath; - /** - * Whether this test is running as part of a parallel suite. - * - * @var bool - */ - public $isInParallel = false; - /** * Holds an instance of the test suite. * diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index bc9e5842..a6f69129 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -485,11 +485,6 @@ ✓ it can call chained macro method ✓ it will throw exception from call if no macro exists - WARN Tests\Features\Parallel - - it can determine in the test case if it is running in parallel - ✓ it can determine in the test case if it is not running in parallel - ✓ it can skip using the test case based on parallel status - PASS Tests\Features\PendingHigherOrderTests ✓ get 'foo' ✓ get 'foo' → get 'bar' → expect true → toBeTrue @@ -652,5 +647,5 @@ ✓ it is a test ✓ it uses correct parent class - Tests: 4 incompleted, 10 skipped, 421 passed + Tests: 4 incompleted, 9 skipped, 419 passed \ No newline at end of file diff --git a/tests/Features/Parallel.php b/tests/Features/Parallel.php deleted file mode 100644 index 9bfe6ea4..00000000 --- a/tests/Features/Parallel.php +++ /dev/null @@ -1,15 +0,0 @@ -isInParallel())->toBeTrue(); -})->skip(!TestSuite::getInstance()->isInParallel); - -it('can determine in the test case if it is not running in parallel', function () { - expect(test()->isInParallel())->toBeFalse(); -})->skip(TestSuite::getInstance()->isInParallel); - -it('can skip using the test case based on parallel status', function () { - expect(TestSuite::getInstance()->isInParallel)->toBeFalse(); -})->skip(function () { return $this->isInParallel(); }); diff --git a/tests/Hooks/BeforeAllTest.php b/tests/Hooks/BeforeAllTest.php index 42efe051..66f5801b 100644 --- a/tests/Hooks/BeforeAllTest.php +++ b/tests/Hooks/BeforeAllTest.php @@ -1,14 +1,13 @@ calls baseline. This is because // two other tests are executed before this one due to filename ordering. $args = $_SERVER['argv'] ?? []; -$single = (isset($args[1]) && Str::endsWith(__FILE__, $args[1])) || TestSuite::getInstance()->isInParallel; +$single = (isset($args[1]) && Str::endsWith(__FILE__, $args[1])) || ($_SERVER['PEST_PARALLEL'] ?? false); $offset = $single ? 0 : 2; uses()->beforeAll(function () use ($globalHook, $offset) { diff --git a/tests/PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder/UsesPerSubDirectory.php b/tests/PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder/UsesPerSubDirectory.php index e98a09e7..01bb8456 100644 --- a/tests/PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder/UsesPerSubDirectory.php +++ b/tests/PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder/UsesPerSubDirectory.php @@ -1,7 +1,5 @@ assertCustomInSubFolderTrue(); -})->skip(TestSuite::getInstance()->isInParallel, 'Nested Pest.php files are not loaded in parallel.'); +}); diff --git a/tests/PHPUnit/Pest.php b/tests/PHPUnit/Pest.php deleted file mode 100644 index 0d513bde..00000000 --- a/tests/PHPUnit/Pest.php +++ /dev/null @@ -1,5 +0,0 @@ -in('CustomTestCaseInSubFolders/SubFolder'); diff --git a/tests/Pest.php b/tests/Pest.php index d3fe584f..429bf74c 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,5 +1,9 @@ in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder'); + uses()->group('integration')->in('Visual'); // NOTE: global test value container to be mutated and checked across files, as needed diff --git a/tests/Visual/Success.php b/tests/Visual/Success.php index ade53e51..4885255e 100644 --- a/tests/Visual/Success.php +++ b/tests/Visual/Success.php @@ -1,7 +1,5 @@ 'integration', 'REBUILD_SNAPSHOTS' => false])); + $process = (new Symfony\Component\Process\Process(['php', 'bin/pest'], dirname($testsPath), ['EXCLUDE' => 'integration', 'REBUILD_SNAPSHOTS' => false, 'PARATEST' => 0])); $process->run(); @@ -37,5 +35,4 @@ test('visual snapshot of test suite on success', function () { expect(implode("\n", $output))->toContain(file_get_contents($snapshot)); } })->skip(!getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE')) - ->skip(TestSuite::getInstance()->isInParallel) ->skip(PHP_OS_FAMILY === 'Windows');