Vote count:
0
I am developing a Angular application that uses third-party libraries. I am currently developing the tests for the two first services and one of them uses an external library called "angular-jsonrpc" installed through "bower". My "karma.config.js" file is the following:
module.exports = function (config) {
'use strict';
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'lib/bower/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js',
'lib/bower/angular-jsonrpc/jsonrpc.js',
'src/scripts/services/celestrak.js',
'src/scripts/services/satnet.js',
'specs/**/*.js'
],
exclude: [],
preprocessors: {},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
I have currently tested the first of the services ("celestrak.js") without problems; however the service "satnet.js" depends on the library "angular-jsonrpc" that is included in the "files" section. The definition for this service is the following:
angular.module('satnet-services', []);
angular.module('satnet-services').service('satnetRPC', [
'jsonrpc', '$location', '$log', '$q', '$http',
function (jsonrpc, $location, $log, $q, $http) {
'use strict';
}]);
The error I get is the following:
Error: [$injector:unpr] Unknown provider: jsonrpcProvider <- jsonrpc <- satnetRPC
http://ift.tt/13LAbsZ
My question is, should I inject a mock library that I develop myself or can I satisfy this dependency by simply specifying the JS library in the files list for karma-jasmine?
asked 13 secs ago
Karma+Jasmine+Bower: dependency injection
Aucun commentaire:
Enregistrer un commentaire