How can I repair the "Latest compiled component path not found" error when testing my Laravel 10 app?

52 Views Asked by At

I have a Laravel 10 application that is using laravel breeze and livewire 3.

When I ran test with PHPUnit (only pre-defined tests) I faced this error :


 FAILED  Tests\Feature\Auth\AuthenticationTest > navigation menu can be rendered
  Expected response status code [200] but received 500.
Failed asserting that 500 is identical to 200.

The following exception occurred during the last request:

Exception: Latest compiled component path not found.

Latest compiled component path not found.

  at tests/Feature/Auth/AuthenticationTest.php:67
     63▕
     64▕         $response = $this->get('/dashboard');
     65▕
     66▕         $response
  ➜  67▕             ->assertOk()
     68▕             ->assertSeeVolt('layout.navigation');
     69▕     }

Livewire seems to be correctly install according to the composer show livewire/livewire results :

name     : livewire/livewire
descrip. : A front-end framework for Laravel.
keywords : 
versions : * v3.4.6
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : 
source   : [git] https://github.com/livewire/livewire.git 7e7d638183b34fb61621455891869f5abfd55a82
dist     : [zip] https://api.github.com/repos/livewire/livewire/zipball/7e7d638183b34fb61621455891869f5abfd55a82 7e7d638183b34fb61621455891869f5abfd55a82
path     : /var/www/projectmanagement/vendor/livewire/livewire
names    : livewire/livewire

support
issues : https://github.com/livewire/livewire/issues
source : https://github.com/livewire/livewire/tree/v3.4.6

autoload
files
psr-4
Livewire\ => src/

requires
illuminate/database ^10.0|^11.0
illuminate/routing ^10.0|^11.0
illuminate/support ^10.0|^11.0
illuminate/validation ^10.0|^11.0
league/mime-type-detection ^1.9
php ^8.1
symfony/http-kernel ^6.2|^7.0

requires (dev)
calebporzio/sushi ^2.1
laravel/framework ^10.0|^11.0
laravel/prompts ^0.1.6
mockery/mockery ^1.3.1
orchestra/testbench 8.20.0|^9.0
orchestra/testbench-dusk 8.20.0|^9.0
phpunit/phpunit ^10.4
psy/psysh ^0.11.22|^0.12

Is there some phpUnit configuration to change?

phpunit.xml :

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
>
    <testsuites>
        <testsuite name="Unit">
            <directory>tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory>tests/Feature</directory>
        </testsuite>
    </testsuites>
    <source>
        <include>
            <directory>app</directory>
        </include>
    </source>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="BCRYPT_ROUNDS" value="4"/>
        <env name="CACHE_DRIVER" value="array"/>
        <!-- <env name="DB_CONNECTION" value="sqlite"/> -->
        <!-- <env name="DB_DATABASE" value=":memory:"/> -->
        <env name="MAIL_MAILER" value="array"/>
        <env name="PULSE_ENABLED" value="false"/>
        <env name="QUEUE_CONNECTION" value="sync"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="TELESCOPE_ENABLED" value="false"/>
    </php>
</phpunit>

According to this topic : https://github.com/livewire/livewire/discussions/7934 it could be the key of the livewire component but no one seem to have a clean solution...

0

There are 0 best solutions below