3
votes

I have a working karma setup, which shows the test-results of my jasmine-tests in the console. If I start the Jasmine SpecRunner.html I get the error "module is not defined" Therefore I added the angular-mock inside the SpecRunner-Header:

<script type="text/javascript" src='src/public/js/libs/angular/angular-mock.js'></script>

Here's my karma.config:

config.set({
basePath: '../..',
frameworks: ['jasmine'],
files: [
  'host/test_app/lib/jasmine-2.0.0/jasmine.js',
  'host/test_app/src/public/js/libs/angular/angular.min.js',
  'host/test_app/src/public/js/libs/angular/angular-mock.js',
  'host/test_app/spec/*.js',
  'host/test_app/src/public/js/controller/*.js'
],
exclude: [    ],
preprocessors: {  },
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome', 'Firefox'],
singleRun: false
});

Is there a way to make karma show the tests with jasmines specrunner?

1

1 Answers

0
votes

try using an unminified angular.js instead of angular.min.js while debugging it would give you a more meaningful error.it worked to me before.

in addition to this, if your modules are injecting asynchronously you should move your angularjs to the top because karma is working like queue while injecting them into karma config file. if im wrong, please correct me.