karma-angular
The Angular team is now reliably releasing all of the angular modules via npm. Typically you'd need to add a bunch of boiler plate referencing those paths, and make sure they are included in the right order.
No longer! Just install this framework and it will scan your package.json, find all your angular dependencies, and make sure they are being served up by karma.
As an added bonus: If you decide to add/remove an angular module later,
just npm install --save
or npm remove --save
it. Your karma config does not need to change.
Note: This is only works for official angular modules released by the Angular team
Install karma-angular
npm install --save-dev karma-angular
Install desired angular-dependencies via npm
npm install --save-dev angular-mocks
npm install --save angular angular-route
Set Up Your karma.conf.js
module{ karma;};
If the automatic scanning is not working for you, you can force which modules are included with an
array of strings as shown below. This really is not recommended, as it's not really saving you any work
(just use the files array at this point) and you lose out on managing those dependencies entirely from
npm install
/ remove
. Provided mostly as a way for you to hot-fix if angular releases a new module you
need right now and I have not white listed it yet. If that is the case, please create an issue, or
better yet write up a quick Pull Request on the white-list in this file.
module{ karma;};
If for some reason you need further examples, one can be found here.