DEV Community

Paulund
Paulund

Posted on • Originally published at paulund.co.uk

Disable Vite During Testing in Laravel

I recently had a project where I wanted github actions to run the tests of a laravel project but i didn't want to install node and vite during the CI process.

When I ran the tests in Github Actions I got the following error

Spatie\LaravelIgnition\Exceptions\ViewException: Vite manifest not found at
Enter fullscreen mode Exit fullscreen mode

I was getting this error because I didn't run npm i && npm run dev before running the tests but because I didn't install node I didn't want to have to run this.

To fix this you can tell your tests to ignore vite by adding the following to your base test case file.

<?php

namespace Tests;

use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;

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

        $this->withoutVite();
    }
}
Enter fullscreen mode Exit fullscreen mode

This will tell your tests to ignore vite and you won't get the error anymore.

Top comments (0)