livewire / livewire/volt

Unexpected long waiting time when testing components with Volt

Open
#132 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
423
Forks
36
PR merge metrics
No merged PRs in 30d

Description

### Volt Version

1.7

### Laravel Version

12.2

### PHP Version

8.4.5

### Database Driver & Version

SQLite / MySQL 8.4.3

### Description

Here's the context:
- I installed [Laravel's Livewire Starter Kit](https://github.com/laravel/livewire-starter-kit) (+ Volt) via Herd.
- A test is missing to achieve 100% coverage with Pest.

The tests are fast enough overall, I was going to make a PR to their repo but I realised the following:
- Each time I run `pest`, the first test running and using `Volt::test` always takes more than 20s.
- Following tests (using `Volt::test` or not) are fast as expected.

Using a clean installation (filtering the tests so we have small examples to work with):

![Image](https://github.com/user-attachments/assets/d768f65b-6308-4166-940e-7fd4f4dcd603)

Indeed, [the test at the very top](https://github.com/laravel/livewire-starter-kit/blob/d1edb7934feae4f0cfda6977ffc969d78edf72b1/tests/Feature/Auth/AuthenticationTest.php#L37) uses Volt.

---

Now, changing the order a bit:

![Image](https://github.com/user-attachments/assets/c4786a46-3b3b-425e-83a8-b49f870b3c71)

In this case, the first test in the list using `Volt::test` is **"reset password link can be requested"** (can be found [here](https://github.com/laravel/livewire-starter-kit/blob/d1edb7934feae4f0cfda6977ffc969d78edf72b1/tests/Feature/Auth/PasswordResetTest.php#L23)).
This time, the execution time was 27.32s instead of 0.22s (in the first screenshot).

Is it expected behavior?
Does Volt need a first long initialisation so the other tests can run lightning fast?

Love Volt so far btw.

### Steps To Reproduce

1. Install Laravel's Livewire Starter Kit (+ Volt) using Herd.
2. Run `pest` in the terminal once it's ready.
3. Expect an odd waiting time, if not I am crazy or it's time to get a new PC.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the Pest suite from the Laravel Livewire Starter Kit reproduction, then compare the first Volt::test call in tests/Feature/Auth/AuthenticationTest.php with the one in tests/Feature/Auth/PasswordResetTest.php. Measure the initialization delay and inspect the reported Volt test behavior; done means establishing whether the delay is expected or isolating a reproducible regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, mysql, php, sqlite
Domain
backend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.