fix: todo in parallel

This commit is contained in:
Nuno Maduro
2023-03-03 01:09:35 +00:00
parent 99436f94f9
commit 2876ac590d
4 changed files with 22 additions and 13 deletions

View File

@ -924,8 +924,9 @@
PASS Tests\Visual\Todo
✓ todo
✓ todo in parallel
PASS Tests\Visual\Version
✓ visual snapshot of help command output
Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 18 skipped, 633 passed (1564 assertions)
Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 18 skipped, 634 passed (1567 assertions)

View File

@ -2,14 +2,16 @@
use Symfony\Component\Process\Process;
$run = function (string $target, $decorated = false) {
$process = new Process(['php', 'bin/pest', $target, '--colors=always'], dirname(__DIR__, 2),
$run = function (string $target, bool $parallel) {
$process = new Process(['php', 'bin/pest', $target, $parallel ? '--parallel' : '', '--colors=always'], dirname(__DIR__, 2),
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
);
$process->run();
return $decorated ? $process->getOutput() : preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput());
expect($process->getExitCode())->toBe(0);
return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput());
};
$snapshot = function ($name) {
@ -23,5 +25,9 @@ $snapshot = function ($name) {
};
test('todo', function () use ($run, $snapshot) {
expect($run('--todo'))->toContain($snapshot('todo'));
expect($run('--todo', false))->toContain($snapshot('todo'));
})->skip(PHP_OS_FAMILY === 'Windows');
test('todo in parallel', function () use ($run, $snapshot) {
expect($run('--todo', true))->toContain($snapshot('todo'));
})->skip(PHP_OS_FAMILY === 'Windows');