Adding some Karma to your workflow
Karma is a JavaScript test runner. This means that it will run your tests for you. Software often grows quickly and Karma gives you a way to run all your unit tests at once. It also gives you the power to add tools that monitor for test coverage and code quality.
Karma is used traditionally in Vue projects and is present in the official Vue templates as a tool. Learning Karma is a great addition for your JavaScript toolbelt even if you are not working with Vue.
Getting ready
I would consider having completed the Using Jasmine for testing Vue recipe a prerequisite. Since Karma is a test runner, you should first be able to write a test.
We will use npm in this recipe, so you should first read the basics on how to use it in the Choosing a development environment recipe.
Â
How to do it...
For this recipe, we will need the command line and npm, so be sure to have it installed before moving ahead.
In a new folder, create a file named package.json
and write the following...