Laravel 12 CommandFinished does not run for php artisan test test
09:57 12 Dec 2025

I would like to implement some logic after all tests in Laravel 12 application finished. I found this blog from 2024 https://laravel.com/docs/12.x/events#main-content which is based on CommandFinished native event. So I made a CommandStartingListener run php artisan event:list and I can see the lister in the list. So it is obviously registered. If I run any command it works BUT as I run php artisan test the listener does not run. All tests pass but the event does not trigger. Thanks for any help.

command);  // Any other command log this line for example php artisan event:list

        if ($event->command === 'test') {
            // Do something...
        }
    }
}

testing events event-listener laravel-12