Catlike14's avatar

Improving test coverage for deferred providers

Deferred providers use a cached manifest (bootstrap/cache/services.php) that skips methods like provides() during tests, lowering coverage. What's the recommended way to bypass or disable this cache in the test environment?

0 likes
1 reply
Catlike14's avatar

I fixed it by cleaning up the compiled files when the test environment is set up. Despite working, I don't think it's a good solution.

protected function setUp(): void
{
    parent::setUp();

    $this->artisan('clear-compiled');
}

Please or to participate in this conversation.