Skip to content

Commit

Permalink
fix: arguments not used and colors
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Jan 25, 2024
1 parent 0bcdf4a commit 9f8513d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -26,7 +26,7 @@
},
"conflict": {
"evenement/evenement": "^1.0",
"pestphp/pest": "<1.0"
"pestphp/pest": "<2.33.0"
},
"autoload": {
"psr-4": {
Expand Down
18 changes: 9 additions & 9 deletions src/Plugin.php
Expand Up @@ -4,7 +4,7 @@

namespace Pest\Watch;

use Pest\Contracts\Plugins\HandlesArguments;
use Pest\Contracts\Plugins\HandlesOriginalArguments;
use Pest\Support\Str;
use React\ChildProcess\Process;
use React\EventLoop\Factory;
Expand All @@ -17,7 +17,7 @@
/**
* @internal
*/
final class Plugin implements HandlesArguments
final class Plugin implements HandlesOriginalArguments

Check failure on line 20 in src/Plugin.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-lowest)

Class Pest\Watch\Plugin implements unknown interface Pest\Contracts\Plugins\HandlesOriginalArguments.

Check failure on line 20 in src/Plugin.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-stable)

Class Pest\Watch\Plugin implements unknown interface Pest\Contracts\Plugins\HandlesOriginalArguments.
{
public const WATCHED_DIRECTORIES = ['app', 'src', 'tests'];

Expand All @@ -36,25 +36,25 @@ public function __construct(OutputInterface $output)
$this->output = $output;
}

public function handleArguments(array $originals): array
public function handleOriginalArguments(array $originalArguments): void

Check failure on line 39 in src/Plugin.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-lowest)

Method Pest\Watch\Plugin::handleOriginalArguments() has parameter $originalArguments with no value type specified in iterable type array.

Check failure on line 39 in src/Plugin.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-stable)

Method Pest\Watch\Plugin::handleOriginalArguments() has parameter $originalArguments with no value type specified in iterable type array.
{
$arguments = array_merge([''], array_values(array_filter($originals, function ($original): bool {
$arguments = array_merge([''], array_values(array_filter($originalArguments, function ($original): bool {
return $original === sprintf('--%s', self::WATCH_OPTION) || Str::startsWith($original, sprintf('--%s=', self::WATCH_OPTION));
})));

$originals = array_flip($originals);
$originalArguments = array_flip($originalArguments);
foreach ($arguments as $argument) {
unset($originals[$argument]);
unset($originalArguments[$argument]);
}
$originals = array_flip($originals);
$originalArguments = array_flip($originalArguments);

$inputs = [];
$inputs[] = new InputOption(self::WATCH_OPTION, null, InputOption::VALUE_OPTIONAL, '', true);

$input = new ArgvInput($arguments, new InputDefinition($inputs));

if (! $input->hasParameterOption(sprintf('--%s', self::WATCH_OPTION))) {
return $originals;
return;
}

$this->checkFswatchIsAvailable();
Expand All @@ -68,7 +68,7 @@ public function handleArguments(array $originals): array
$watcher = new Watch($loop, $this->watchedDirectories);
$watcher->run();

$command = implode(' ', $originals);
$command = implode(' ', [...$originalArguments, '--colors=always']);

$output = $this->output;

Expand Down

0 comments on commit 9f8513d

Please sign in to comment.