Introduction
Development of the integrated Hello Bruce Trail is shifting to more of a focus on the front end.
After reading several articles about test tools for JavaScript, I decided to look into adding tools like Jasmine and Karma to my workflow.
Laravel already comes with test tools – phpunit, dusk. Phpunit has a focus on unit testing for PHP and I am using it to execute automated testing for the back end. Dusk is an end-to-end browser testing tool for JavaScript enabled applications. I’m using it for various browser tests.
As I traverse the Vue and JavaScript learning curves I expect I’ll be revising and refactoring some of the components I’ve written and I think that using a tool such as Jasmine will help make revisions with greater confidence that I will not be breaking things that I already got working.
The question is… where to start? There are so many articles and posts on how to install and configure Jasmine and Karma; with each article making various assumptions about the development environment, so which is the procedure that will work for Hello Bruce Trail?
Jasmine and Karma
Jasmine and Karma sound like a combination I’d like to try out but one step at a time -I’d like to see Jasmine up and running before I try to add Karma on top of it.
STRIKE ALL OF THAT! I apparently got it working by following the instructions at this article <a href=”https://oliverlundquist.com/2018/01/23/laravel-mix-with-karma-jasmine-chrome.html” rel=”noopener” target=”_blank>Vue Unit Testing in Karma with Laravel Mix using Jasmine, Webpack and Chrome. I’m not sure whether it was blind luck and if I’ll successfully reproduce that in another branch (or project) by following the same steps. I swear I tried them before and they didn’t work!
npm install --save-dev jasmine-core
Installing npm packages without sudo
I don’t know yet whether I am going to need this or not but in case it comes up, here is a link to an article on how to Install npm packages globally without sudo on macOS and Linux.