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

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();
    }
}

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

UpChecker

Reliable uptime monitoring and instant alerts for any website downtime.

  • Uptime Monitoring
  • Performance Monitoring
  • SSL Certificate Alerts
  • Domain Monitoring
  • DNS Checker
  • XML Sitemap Monitoring