DEV Community

Paulund
Paulund

Posted on • Originally published at paulund.co.uk

1

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.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay