Add --force flag to pest:test command

This commit is contained in:
Reza Amini
2021-07-21 13:02:09 +04:30
committed by GitHub
parent 47ceb2419b
commit 7ec3460d73

View File

@ -21,7 +21,7 @@ final class PestTestCommand extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test} {--dusk : Create a Dusk test} {--test-directory=tests : The name of the tests directory}'; protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test} {--dusk : Create a Dusk test} {--test-directory=tests : The name of the tests directory} {--force : Force create}';
/** /**
* The console command description. * The console command description.
@ -56,7 +56,7 @@ final class PestTestCommand extends Command
File::makeDirectory(dirname($target), 0777, true, true); File::makeDirectory(dirname($target), 0777, true, true);
} }
if (File::exists($target)) { if (File::exists($target) and !$this->option('force')) {
throw new InvalidConsoleArgument(sprintf('%s already exist', $target)); throw new InvalidConsoleArgument(sprintf('%s already exist', $target));
} }