Use Laravel Dusk to Test JS-Based Applications – Laravel News

Laravel News
Laravel News
Laravel News
March 22nd, 2022

Laravel Husk is a thin, light scaffolded Laravel Dusk environment. It allows you to test JavaScript applications with PHP using Pest without scaffolding an entire Laravel application.
Once you’ve followed the installation instructions, you can write Dusk feature tests like any other application using Dusk. You’ll have a browser folder, and inside of that folder, you can run your Dusk test suite with the following command:
Here’s an example of a test from a demo Nuxt application using Husk for end-to-end feature tests:
There’s not much more to learn beyond the Dusk and Pest documentation. Husk takes the pain out of setting up a Dusk environment outside of Laravel applications and provides an easy path to test JS applications with familiar tools.
The author has some example projects written in Nuxt, Gatsby, and Gridsome. These examples are helpful to visualize all the moving pieces involved in testing JS apps with Dusk. It looks like NextJS and Svelte are planned, but the links were broken when I looked through the Husk readme.
To get started in your own project, check out Laravel Husk on GitHub. The README also includes a GitHub actions template you can use to start running Dusk tests in your JS projects.
Filed in:

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.
Join 33,000+ others and never miss out on new tips, tutorials, and more.
The official Laravel job board connecting the best jobs with top talent.
March 21st, 2022
March 18th, 2022
March 17th, 2022
Subscribe to the Email Newsletter
Follow Laravel News on
Design & development by
© 2012 – 2022 Laravel News
A division of dotdev inc.


Related Post

Leave a Reply

Your email address will not be published.

Translate »