fix: --todos in parallel and feedback on process isolation

This commit is contained in:
Nuno Maduro
2023-03-19 02:01:08 +00:00
parent 48ea48981b
commit 2da899a2b1
5 changed files with 40 additions and 6 deletions

View File

@ -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);
try {
$kernel = Kernel::boot($testSuite, $input, $output); $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);
})(); })();

View File

@ -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"

View File

@ -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.

View 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;
}
}

View File

@ -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');