testo/filter
Testo filtering plugin that selects which tests run by name patterns, file paths, suites, types, and dataset pointers. Powers Testo CLI flags: --filter, --path, --suite, and --type.
TestCase, phpunit.xml, or Artisan test workflows). Laravel’s default testing stack (PHPUnit/Pest) already provides robust filtering capabilities (--filter, --group, --testdox-html), making this package a non-ideal fit unless:
--filter, --path), but Laravel’s testing is event-driven (e.g., TestCase lifecycle hooks, service container integration). This misalignment could lead to workarounds (e.g., custom Artisan commands) rather than seamless integration.TestWorker or TestCase to delegate filtering logic to Testo.assertDatabaseHas, actingAs).testsStarted, testFailed).| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| Framework Lock-in | Testo is not Laravel-native; future Laravel updates may break compatibility. | Treat as a temporary or niche solution; avoid for core test workflows. |
| CLI vs. Programmatic | Package is CLI-first; Laravel’s testing is programmatic (e.g., TestCase methods). |
Build a service provider to expose filtering logic via Laravel’s DI container. |
| Maintenance Burden | Testo is low-activity (0 stars, read-only mirror); no Laravel-specific support. | Fork the package or contribute to Testo’s monorepo for Laravel integrations. |
| Performance Overhead | Testo’s filtering may not optimize for Laravel’s parallel testing (e.g., phpunit-parallel). |
Benchmark against PHPUnit’s --filter; avoid if performance is critical. |
| Tooling Ecosystem | No IDE plugins, VS Code test adapters, or Laravel-specific integrations (e.g., laravel-shift). |
Document limitations; recommend PHPUnit/Pest for IDE workflows. |
| Assertion Incompatibility | Testo lacks Laravel’s domain-specific assertions (e.g., database, queue, HTTP). | Use Testo only for filtering, not assertions; keep Laravel’s TestCase for logic. |
Strategic Alignment:
Integration Scope:
CLI vs. Programmatic Needs:
artisan testo:run --filter=UserTest) or programmatic hooks (e.g., TestCase::filter())?@group, --filter) meet the same goals?Team and Tooling:
Long-Term Viability:
Performance and CI Impact:
TestCase integration.phpunit.xml or Pest configuration support.--filter, --group, and Laravel’s TestCase support.tests()->filter()) with Laravel integration.TestCase trait or service provider.composer require --dev testo/filter
// app/Console/Commands/TestoFilter.php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class TestoFilter extends Command {
protected $signature = 'testo:filter {filter?}';
public function handle() {
$filter = $this->argument('filter') ?? '';
$command = "vendor/bin/testo run --filter={$filter}";
$output = shell_exec($command);
$this->output->write($output);
}
}
# .github/workflows/test.yml
- run: php artisan testo:filter "AuthTest"
assertDatabaseHas).vendor/bin/testo run --list | grep "AuthTest" > filtered_tests.txt
phpunit --test-list=filtered_tests.txt
# scripts/filter-and-run.sh
FILTER=$1
vendor/bin/testo run --list | grep "$FILTER" | phpunit --test-list=/dev/stdin
Illuminate\Foundation\Testing\TestCase to use Testo’s runner.runTest() to delegate to Testo’s core.assertTrue() instead of assertDatabaseHas()).| Component | Compatibility | Mitigation |
|---|---|---|
| PHP Version | Medium | Ensure Testo’s PHP version matches Laravel’s (e.g., Testo 1.x may lag). |
| Autoloading | High | Isolate Testo in a separate namespace or Docker container. |
| CLI Output | High |
How can I help you explore Laravel packages today?