Testing Livewire v4 with Pest v4
February 01, 2026
•
1 min read
•
39 views
Livewire v4 integrates with Pest v4 for real browser-based testing.
Setup
composer require pestphp/pest --dev
php artisan pest:installComponent Test
it('increments the counter', function () {
Livewire::test(Counter::class)
->assertSee('Count: 0')
->call('increment')
->assertSee('Count: 1');
});
it('validates input', function () {
Livewire::test(CreatePost::class)
->set('title', '')
->call('save')
->assertHasErrors(['title' => 'required']);
});
Related Posts
Introduction to Livewire v4: The Future of Laravel Full-Stack Development
Discover what's new in Livewire v4 and why it's a game-changer for Laravel developers.
Single-File Components in Livewire v4: The View-First Approach
Learn how to create single-file components with the new .wire.php extension.
Multi-File Components (MFC) in Livewire v4
Organize complex components with the new multi-file component structure.
Comments (0)
No comments yet. Be the first to comment!