mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: todo in parallel
This commit is contained in:
8
bin/pest
8
bin/pest
@ -22,12 +22,12 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
$todo = false;
|
$todo = false;
|
||||||
|
|
||||||
foreach ($args as $key => $value) {
|
foreach ($args as $key => $value) {
|
||||||
if (str_contains($value, '--compact')) {
|
if ($value === '--compact') {
|
||||||
$_SERVER['COLLISION_PRINTER_COMPACT'] = 'true';
|
$_SERVER['COLLISION_PRINTER_COMPACT'] = 'true';
|
||||||
unset($args[$key]);
|
unset($args[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_contains($value, '--profile')) {
|
if ($value === '--profile') {
|
||||||
$_SERVER['COLLISION_PRINTER_PROFILE'] = 'true';
|
$_SERVER['COLLISION_PRINTER_PROFILE'] = 'true';
|
||||||
unset($args[$key]);
|
unset($args[$key]);
|
||||||
}
|
}
|
||||||
@ -36,12 +36,12 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
unset($args[$key]);
|
unset($args[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_contains($value, '--dirty')) {
|
if ($value === '--dirty') {
|
||||||
$dirty = true;
|
$dirty = true;
|
||||||
unset($args[$key]);
|
unset($args[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_contains($value, '--todo')) {
|
if ($value === '--todo') {
|
||||||
$todo = true;
|
$todo = true;
|
||||||
unset($args[$key]);
|
unset($args[$key]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,11 +68,13 @@ final class ResultPrinter
|
|||||||
public function print(string $buffer): void
|
public function print(string $buffer): void
|
||||||
{
|
{
|
||||||
$buffer = OutputFormatter::escape($buffer);
|
$buffer = OutputFormatter::escape($buffer);
|
||||||
|
if (str_starts_with($buffer, "\nGenerating code coverage report")) {
|
||||||
if (! str_starts_with($buffer, "\nGenerating code coverage report")
|
return;
|
||||||
&& ! str_starts_with($buffer, 'done [')) {
|
|
||||||
$this->output->write(OutputFormatter::escape($buffer));
|
|
||||||
}
|
}
|
||||||
|
if (str_starts_with($buffer, 'done [')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->output->write(OutputFormatter::escape($buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function flush(): void
|
public function flush(): void
|
||||||
|
|||||||
@ -924,8 +924,9 @@
|
|||||||
|
|
||||||
PASS Tests\Visual\Todo
|
PASS Tests\Visual\Todo
|
||||||
✓ todo
|
✓ todo
|
||||||
|
✓ todo in parallel
|
||||||
|
|
||||||
PASS Tests\Visual\Version
|
PASS Tests\Visual\Version
|
||||||
✓ visual snapshot of help command output
|
✓ 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)
|
||||||
@ -2,14 +2,16 @@
|
|||||||
|
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
|
|
||||||
$run = function (string $target, $decorated = false) {
|
$run = function (string $target, bool $parallel) {
|
||||||
$process = new Process(['php', 'bin/pest', $target, '--colors=always'], dirname(__DIR__, 2),
|
$process = new Process(['php', 'bin/pest', $target, $parallel ? '--parallel' : '', '--colors=always'], dirname(__DIR__, 2),
|
||||||
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
|
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$process->run();
|
$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) {
|
$snapshot = function ($name) {
|
||||||
@ -23,5 +25,9 @@ $snapshot = function ($name) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
test('todo', function () use ($run, $snapshot) {
|
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');
|
})->skip(PHP_OS_FAMILY === 'Windows');
|
||||||
|
|||||||
Reference in New Issue
Block a user