I've installed Karma and karma-jasmine using Yeoman as follows:
$ npm install -g generator-angular
$ mkdir myapp && cd $_
$ yo angular
Given that myapp/bower.json
didn't list Jasmine as one of the Bower installed front-end packages but myapp/karma.conf.js
listed Jasmine as the default testing framework, I was surprised the command grunt test
worked. (The Gruntfile.js
, bower.json
, and karma.conf.js
files were all created as part of the yo angular
scaffolding process.)
Upon closer inspection of the myapp/node_modules
packages, I realized that karma-jasmine doesn't point to a separate installation of Jasmine. The karma-jasmine plugin actually installs Jasmine:
▼ myapp/
▼ karma_jasmine/
▼ lib/
adapter.js
index.js
jasmine.js
Given that karma-jasmine says it is an "adapter for the Jasmine testing framework," I was a little surprised that karma-jasmine didn't require us to install Jasmine separately.
Here are the various package versions used:
myapp/package.json
contentsmyapp/package.json
contentsnpm list -g | grep yo
command resultsYou can know the jasmine version you are using by running the following Spec:
describe('Test to print out jasmine version', function() {
it('prints jasmine version', function() {
console.log('jasmine-version:');
console.log(jasmine.version || (jasmine.getEnv().versionString && jasmine.getEnv().versionString()));
});
});
and then checking the karma output in your console or browser. It should be something like:
LOG: 'jasmine-version:'
LOG: '2.3.4'
The jasmine library is included in the jasmine-runner plugin as you've already found out. You can find the exact place where this file is loaded in the source code of the plugin: https://github.com/karma-runner/karma-jasmine/blob/master/lib/index.js (line 7)
You can try to modify the plugin so that an upgrade is possible and send a pull request to karma (see http://karma-runner.github.io/0.10/dev/contributing.html)