From 5932ffd78b879e3a5d46275b25ce84819229aa4b Mon Sep 17 00:00:00 2001
From: Nuno Maduro <enunomaduro@gmail.com>
Date: Wed, 6 May 2020 16:22:17 +0200
Subject: [PATCH] Uses Pest if available

---
 src/Console/DuskCommand.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Console/DuskCommand.php b/src/Console/DuskCommand.php
index df99e77d2..1aaac8c3c 100644
--- a/src/Console/DuskCommand.php
+++ b/src/Console/DuskCommand.php
@@ -88,11 +88,15 @@ public function handle()
      */
     protected function binary()
     {
+        $command = class_exists(\Pest\Laravel\PestServiceProvider::class)
+            ? 'vendor/pestphp/pest/bin/pest'
+            : 'vendor/phpunit/phpunit/phpunit';
+
         if ('phpdbg' === PHP_SAPI) {
-            return [PHP_BINARY, '-qrr', 'vendor/phpunit/phpunit/phpunit'];
+            return [PHP_BINARY, '-qrr', $command];
         }
 
-        return [PHP_BINARY, 'vendor/phpunit/phpunit/phpunit'];
+        return [PHP_BINARY, $command];
     }
 
     /**