Karma not running any unit test cases

264 Views Asked by At

I am trying to set up Karma for a small demo project. The problem is that Karma is not executing any test cases.

My project has only two .js files: app/js/app.js and test/spec/app.spec.js My karma config file is as follows:

module.exports = function(config) {
   config.set({
     basePath: '',
     frameworks: ['jasmine'],
     plugins: ['karma-jasmine','karma-phantomjs-launcher'],
     files: [
        'app/js/app.js',
        'test/spec/app.spec.js',
     ],
     exclude: [
     ],
     preprocessors: {},
     reporters: ['dots'],
     port: 9876,
     colors: true,
     logLevel: config.LOG_INFO,
     autoWatch: true,
     browsers: ['PhantomJS'],
     singleRun: true
     });
  };

The temporary contents of my app.spec.js file are:

describe('app js', function(){   
   it('test');    
});

I am using Gulp in my project and I have written the following gulp task for testing:

gulp.task('test', function() {
   gulp.src('app/js/**/*.js')
   .pipe(karma({
      configFile: 'karma.conf.js',
      action: 'watch'
   }));
});

This is what I am getting in the terminal on running gulp test:

Starting Karma server...
WARN `start` method is deprecated since 0.13. It will be removed in 0.14. 
Please use 
server = new Server(config, [done])
server.start()
instead.
11 01 2018 22:26:29.672:WARN [karma]: No captured browser, open http://localhost:9876/
11 01 2018 22:26:29.686:INFO [karma]: Karma v2.0.0 server started at http://0.0.0.0:9876/
11 01 2018 22:26:29.687:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
11 01 2018 22:26:29.693:INFO [launcher]: Starting browser PhantomJS
11 01 2018 22:26:30.239:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected 
on socket J2AB2rwIs49mJwRQAAAA with id 34572564
PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 0 ERROR (0 secs / 0 secs)

Can anyone please let me know that what am I doing wrong here?

0

There are 0 best solutions below