Bugfix. The TestCase is now aware of if it is running in parallel or not 😎

This commit is contained in:
luke
2021-08-05 17:09:45 +01:00
parent 1ca9aa5ca6
commit 62aabc6ae1
4 changed files with 27 additions and 10 deletions

View File

@ -1,13 +1,14 @@
<?php
use Pest\Support\Str;
use Pest\TestSuite;
global $globalHook;
// HACK: we have to determine our $globalHook->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]);
$single = isset($args[1]) && Str::endsWith(__FILE__, $args[1]) || TestSuite::getInstance()->isInParallel;
$offset = $single ? 0 : 2;
uses()->beforeAll(function () use ($globalHook, $offset) {