From 73f56e58a5266470ba9ff1f7cd698830fb14e177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jib=C3=A9=20Barth?= Date: Sun, 31 May 2020 12:32:43 +0200 Subject: [PATCH 1/2] Pass color and verbosity args to printer (fix #49) --- src/Actions/AddsDefaults.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Actions/AddsDefaults.php b/src/Actions/AddsDefaults.php index 951a1e46..799eda6e 100644 --- a/src/Actions/AddsDefaults.php +++ b/src/Actions/AddsDefaults.php @@ -21,7 +21,7 @@ final class AddsDefaults public static function to(array $arguments): array { if (!array_key_exists('printer', $arguments)) { - $arguments['printer'] = new Printer(); + $arguments['printer'] = new Printer(null, $arguments['verbose'] ?? false, $arguments['colors'] ?? 'always'); } return $arguments; From 28d06663d314f2104cdcfe3b25c4272c75747fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jib=C3=A9=20Barth?= Date: Sun, 31 May 2020 12:33:27 +0200 Subject: [PATCH 2/2] Add tests for --colors=never option --- tests/.snapshots/success.txt | 6 +++-- tests/Visual/SingleTestOrDirectory.php | 34 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 25f4531a..4509aee3 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -124,9 +124,11 @@ PASS Tests\Visual\SingleTestOrDirectory ✓ allows to run a single test ✓ allows to run a directory + ✓ it has ascii chars (decorated printer) + ✓ it disable decorating printer when colors is set to never WARN Tests\Visual\Success s visual snapshot of test suite on success - Tests: 6 skipped, 67 passed - Time: 2.67s + Tests: 6 skipped, 69 passed + Time: 2.34s diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index 6dd9204b..d7a42e0a 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -30,3 +30,37 @@ test('allows to run a directory', function () use ($run) { Tests: 2 passed EOF, $run('tests/Fixtures')); }); + +it('has ascii chars (decorated printer)', function () { + $process = new Process([ + './bin/pest', + 'tests/Fixtures/DirectoryWithTests/ExampleTest.php', + ], dirname(__DIR__, 2)); + + $process->run(); + $output = $process->getOutput(); + assertStringContainsString(<<run(); + $output = $process->getOutput(); + + assertStringContainsString(<<