diff --git a/modules/Example/tests/ShardModuleExample.php b/modules/Example/tests/ShardModuleExample.php new file mode 100644 index 000000000..66083b652 --- /dev/null +++ b/modules/Example/tests/ShardModuleExample.php @@ -0,0 +1,5 @@ +toBeTrue(); +}); diff --git a/src/Plugins/Shard.php b/src/Plugins/Shard.php index 814125f20..610ce8949 100644 --- a/src/Plugins/Shard.php +++ b/src/Plugins/Shard.php @@ -193,7 +193,7 @@ private function allTests(array $arguments): array '--list-tests', ]))->setTimeout(120)->mustRun()->getOutput(); - preg_match_all('/ - (?:P\\\\)?(Tests\\\\[^:]+)::/', $output, $matches); + preg_match_all('/ - (?:P\\\\)?([^:]+)::/', $output, $matches); return array_values(array_unique($matches[1])); } diff --git a/tests/Unit/Plugins/Shard.php b/tests/Unit/Plugins/Shard.php new file mode 100644 index 000000000..6cc7363f7 --- /dev/null +++ b/tests/Unit/Plugins/Shard.php @@ -0,0 +1,13 @@ +createMock(OutputInterface::class)); + + $allTests = \Closure::bind(fn (array $arguments): array => $this->allTests($arguments), $plugin, ShardPlugin::class); + + expect($allTests(['bin/pest', 'modules/Example/tests/ShardModuleExample.php'])) + ->toContain('Modules\\Example\\tests\\ShardModuleExample'); +});