mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: --todos in parallel and feedback on process isolation
This commit is contained in:
11
bin/pest
11
bin/pest
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
use Pest\ConfigLoader;
|
use Pest\ConfigLoader;
|
||||||
use Pest\Kernel;
|
use Pest\Kernel;
|
||||||
|
use Pest\Panic;
|
||||||
use Pest\TestCaseFilters\GitDirtyTestCaseFilter;
|
use Pest\TestCaseFilters\GitDirtyTestCaseFilter;
|
||||||
use Pest\TestCaseMethodFilters\TodoTestCaseFilter;
|
use Pest\TestCaseMethodFilters\TodoTestCaseFilter;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
@ -85,11 +86,15 @@ use Symfony\Component\Console\Output\ConsoleOutput;
|
|||||||
|
|
||||||
$output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, $isDecorated);
|
$output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, $isDecorated);
|
||||||
|
|
||||||
$kernel = Kernel::boot($testSuite, $input, $output);
|
try {
|
||||||
|
$kernel = Kernel::boot($testSuite, $input, $output);
|
||||||
|
|
||||||
$result = $kernel->handle($args);
|
$result = $kernel->handle($args);
|
||||||
|
|
||||||
$kernel->shutdown();
|
$kernel->shutdown();
|
||||||
|
} catch (Throwable|Error $e) {
|
||||||
|
Panic::with($e);
|
||||||
|
}
|
||||||
|
|
||||||
exit($result);
|
exit($result);
|
||||||
})();
|
})();
|
||||||
|
|||||||
@ -94,6 +94,7 @@
|
|||||||
"Pest\\Plugins\\Help",
|
"Pest\\Plugins\\Help",
|
||||||
"Pest\\Plugins\\Memory",
|
"Pest\\Plugins\\Memory",
|
||||||
"Pest\\Plugins\\Printer",
|
"Pest\\Plugins\\Printer",
|
||||||
|
"Pest\\Plugins\\ProcessIsolation",
|
||||||
"Pest\\Plugins\\Retry",
|
"Pest\\Plugins\\Retry",
|
||||||
"Pest\\Plugins\\Version",
|
"Pest\\Plugins\\Version",
|
||||||
"Pest\\Plugins\\Parallel"
|
"Pest\\Plugins\\Parallel"
|
||||||
|
|||||||
@ -32,7 +32,7 @@ final class Parallel implements HandlesArguments
|
|||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private const UNSUPPORTED_ARGUMENTS = ['--todo', '--retry'];
|
private const UNSUPPORTED_ARGUMENTS = ['--todos', '--retry'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the given command line arguments indicate that the test suite should be run in parallel.
|
* Whether the given command line arguments indicate that the test suite should be run in parallel.
|
||||||
|
|||||||
28
src/Plugins/ProcessIsolation.php
Normal file
28
src/Plugins/ProcessIsolation.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Pest\Plugins;
|
||||||
|
|
||||||
|
use Pest\Contracts\Plugins\HandlesArguments;
|
||||||
|
use Pest\Exceptions\InvalidOption;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class ProcessIsolation implements HandlesArguments
|
||||||
|
{
|
||||||
|
use Concerns\HandleArguments;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function handleArguments(array $arguments): array
|
||||||
|
{
|
||||||
|
if ($this->hasArgument('--process-isolation', $arguments)) {
|
||||||
|
throw new InvalidOption('The [--process-isolation] option is not supported.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arguments;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,9 +25,9 @@ $snapshot = function ($name) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
test('todo', function () use ($run, $snapshot) {
|
test('todo', function () use ($run, $snapshot) {
|
||||||
expect($run('--todo', false))->toContain($snapshot('todo'));
|
expect($run('--todos', false))->toContain($snapshot('todo'));
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skip(PHP_OS_FAMILY === 'Windows');
|
||||||
|
|
||||||
test('todo in parallel', function () use ($run, $snapshot) {
|
test('todo in parallel', function () use ($run, $snapshot) {
|
||||||
expect($run('--todo', true))->toContain($snapshot('todo'));
|
expect($run('--todos', true))->toContain($snapshot('todo'));
|
||||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
})->skip(PHP_OS_FAMILY === 'Windows');
|
||||||
|
|||||||
Reference in New Issue
Block a user