From 8b8144d5b4cda8ec76f1117900f64ae20f8e05ff Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Tue, 17 Oct 2023 04:27:42 +0800 Subject: [PATCH] Fixes unknown option "--ansi" and "--no-ansi" (#1068) * Fixes unknown option "--ansi" and "--no-ansi" fixes #1066 Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki --------- Signed-off-by: Mior Muhammad Zaki --- .github/workflows/tests.yml | 2 +- src/Console/DuskCommand.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2162959f1..21810efe0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -104,6 +104,6 @@ jobs: run: php artisan serve --no-reload & - name: Run Dusk Tests - run: php artisan dusk --without-tty + run: php artisan dusk --without-tty --ansi env: APP_URL: http://127.0.0.1:8000 diff --git a/src/Console/DuskCommand.php b/src/Console/DuskCommand.php index 0701b2367..1260c3dc2 100644 --- a/src/Console/DuskCommand.php +++ b/src/Console/DuskCommand.php @@ -125,13 +125,23 @@ protected function phpunitArguments($options) } $options = array_values(array_filter($options, function ($option) { - return ! Str::startsWith($option, ['--env=', '--pest']); + return ! Str::startsWith($option, ['--env=', '--pest', '--ansi', '--no-ansi']); })); if (! file_exists($file = base_path('phpunit.dusk.xml'))) { $file = base_path('phpunit.dusk.xml.dist'); } + if (version_compare(Version::id(), '10.0', '>=')) { + if ($this->option('ansi')) { + $options[] = '--colors=always'; + } + + if ($this->option('no-ansi')) { + $options[] = '--colors=never'; + } + } + return array_merge(['-c', $file], $options); }