This section covers some solutions that one might need when using the Backbone generator.
Problem: You want to run your project's unit tests with Karma and generate code coverage for your project.
Solution: Since you want to use Karma and leverage the karma-coverage plugin, you will need to create and configure a test/test-main.js
file that will parse all the indexed files and create an array of spec files that are then added to the Require.js configuration as dependencies. After all the files have been indexed, you will need to start Karma so the specs can be run. To do so, perform the following steps:
Since the Yeoman Backbone generator creates a Karma configuration file located in the root of the project directory by default, all that is needed is to install the karma-coverage plugin and enable it in your karma.conf.js
file.
To install karma-coverage, open the terminal and execute the following command:
$ npm...