unit testing - configuration of karma/jasmine to test angularjs throws: No provider for "framework:jasmine"! -
hello i'm trying implement unit-tests angularjs karma , jasmine. followed therefore tutorial: http://tech.pro/tutorial/1473/getting-started-with-angularjs-unit-testing
on point running first test sucked because of error:
no provider "framework:jasmine"!
i googled , tried suggested things installing karma-jasmine , karma-chrome-launcher again none of these worked me.
my package.json looks this:
{ "name": "projectname", "version": "1.0.0", "description": "a description", "dependencies": { "gulp": "^3.5.6", "gulp-sass": "^1.3.3", "gulp-concat": "^2.2.0", "gulp-minify-css": "^0.3.0", "gulp-rename": "^1.2.0" }, "devdependencies": { "bower": "^1.3.3", "gulp-util": "^2.2.14", "jasmine-core": "^2.3.4", "karma": "^0.12.36", "karma-chrome-launcher": "^0.1.12", "karma-jasmine": "^0.3.5", "karma-safari-launcher": "^0.1.1", "shelljs": "^0.3.0" }, "cordovaplugins": [ "org.apache.cordova.device", "org.apache.cordova.console", "com.ionic.keyboard" ], "cordovaplatforms": [ "android", "ios" ] } and karma configuration karma.conf.js:
module.exports = function(config) { config.set({ // base path used resolve patterns (eg. files, exclude) basepath: '', // frameworks use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], // list of files / patterns load in browser files: [ 'test/*/specs.js', 'test/*' ], // list of files exclude exclude: [ ], // preprocess matching files before serving them browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { }, // test results reporter use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress'], // web server port port: 9876, // enable / disable colors in output (reporters , logs) colors: true, // level of logging // possible values: config.log_disable || config.log_error || config.log_warn || config.log_info || config.log_debug loglevel: config.log_info, // enable / disable watching file , executing tests whenever file changes autowatch: true, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['chrome', 'safari'], // continuous integration mode // if true, karma captures browsers, runs tests , exits singlerun: false }); }; if run karma start karma.conf.js error. changed permission of these 2 files without effect. problem here?
it turned out have installed karma globally npm install -g karma , karma-jasmine locally npm install karma-jasmine. reinstalled karma-jasmine globally , working.
Comments
Post a Comment