Improvements

This commit is contained in:
luke
2021-08-05 15:31:09 +01:00
parent 5526d4c24d
commit 256b167eaf
3 changed files with 17 additions and 2 deletions

View File

@ -62,7 +62,7 @@ use Symfony\Component\Console\Output\OutputInterface;
$_SERVER['argv'][] = '--runner'; $_SERVER['argv'][] = '--runner';
$_SERVER['argv'][] = Runner::class; $_SERVER['argv'][] = Runner::class;
exit(ParaTestCommand::applicationFactory(getcwd())->run(new ArgvInput())); exit(ParaTestCommand::applicationFactory($testSuite->rootPath)->run(new ArgvInput()));
} }
exit($container->get(Command::class)->run($_SERVER['argv'])); exit($container->get(Command::class)->run($_SERVER['argv']));

View File

@ -40,7 +40,7 @@ final class PestRunnerWorker
$args = array_merge( $args = array_merge(
$args, $args,
$this->executableTest->commandArguments( $this->executableTest->commandArguments(
'/Users/luke/Packages/pest/bin/pest', $this->getPestBinary(),
$options->filtered(), $options->filtered(),
$options->passthru() $options->passthru()
) )
@ -109,6 +109,17 @@ final class PestRunnerWorker
} }
} }
private function getPestBinary(): string
{
// Used when Pest is required using composer.
$vendorPath = dirname(__DIR__, 7) . '/bin/pest';
// Used when Pest maintainers are running Pest tests.
$localPath = dirname(__DIR__, 3) . '/bin/pest';
return file_exists($vendorPath) ? $vendorPath : $localPath;
}
public function getWorkerCrashedException(?Throwable $previousException = null): WorkerCrashedException public function getWorkerCrashedException(?Throwable $previousException = null): WorkerCrashedException
{ {
return WorkerCrashedException::fromProcess( return WorkerCrashedException::fromProcess(

View File

@ -13,6 +13,7 @@ use ParaTest\Runners\PHPUnit\Options;
use ParaTest\Runners\PHPUnit\ResultPrinter; use ParaTest\Runners\PHPUnit\ResultPrinter;
use ParaTest\Runners\PHPUnit\RunnerInterface; use ParaTest\Runners\PHPUnit\RunnerInterface;
use ParaTest\Runners\PHPUnit\SuiteLoader; use ParaTest\Runners\PHPUnit\SuiteLoader;
use Pest\Actions\LoadStructure;
use Pest\Factories\TestCaseFactory; use Pest\Factories\TestCaseFactory;
use Pest\TestSuite; use Pest\TestSuite;
use PHPUnit\TextUI\TestRunner; use PHPUnit\TextUI\TestRunner;
@ -100,6 +101,8 @@ final class Runner implements RunnerInterface
{ {
$this->beforeLoadChecks(); $this->beforeLoadChecks();
LoadStructure::in(TestSuite::getInstance()->rootPath);
$loader->load(); $loader->load();
$this->loadPestSuite(); $this->loadPestSuite();
@ -327,6 +330,7 @@ final class Runner implements RunnerInterface
private function loadPestSuite(): void private function loadPestSuite(): void
{ {
$pestTestSuite = TestSuite::getInstance(); $pestTestSuite = TestSuite::getInstance();
LoadStructure::in($pestTestSuite->rootPath);
$files = array_values(array_map(function (TestCaseFactory $factory): string { $files = array_values(array_map(function (TestCaseFactory $factory): string {
return $factory->filename; return $factory->filename;