mirror of
https://github.com/pestphp/pest.git
synced 2026-03-11 10:17:23 +01:00
feat: --todo flag
This commit is contained in:
27
tests/Visual/Todo.php
Normal file
27
tests/Visual/Todo.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
$run = function (string $target, $decorated = false) {
|
||||
$process = new Process(['php', 'bin/pest', $target, '--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());
|
||||
};
|
||||
|
||||
$snapshot = function ($name) {
|
||||
$testsPath = dirname(__DIR__);
|
||||
|
||||
return file_get_contents(implode(DIRECTORY_SEPARATOR, [
|
||||
$testsPath,
|
||||
'.snapshots',
|
||||
"$name.txt",
|
||||
]));
|
||||
};
|
||||
|
||||
test('todo', function () use ($run, $snapshot) {
|
||||
expect($run('--todo'))->toContain($snapshot('todo'));
|
||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
||||
Reference in New Issue
Block a user