Adds a new method, isInParallel, to the Testable trait to allow a test to determine its parallel status.

This commit is contained in:
luke
2021-08-10 14:34:10 +01:00
parent bcab4224fb
commit 5c592928d4
4 changed files with 31 additions and 2 deletions

View File

@ -0,0 +1,15 @@
<?php
use Pest\TestSuite;
it('can determine in the test case if it is running in parallel', function () {
expect(test()->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(); });