jeudi 1 septembre 2016

Gulp cannot find uni tests - AngularJS

I am using angular-kickstart for my project(http://ift.tt/1triBFb). I have following karma.config.js file:

'use strict';

var baseDir = 'client';

module.exports = {

  //This is the list of file patterns to load into the browser during testing.
  files: [
    baseDir + '/src/vendor/angular/angular.js',
    baseDir + '/src/vendor/angular-mocks/angular-mocks.js',
    baseDir + '/src/vendor/angular-ui-router/release/angular-ui-router.js',
    baseDir + '/src/vendor/angular-bootstrap/ui-bootstrap.min.js',
    baseDir + '/src/app/modules/home/home.module.js',
    baseDir + '/src/app/modules/login/login.module.js',
    baseDir + '/src/app/app.js',
    baseDir + '/src/app/**/*.js',
    baseDir + '/test/unit/**/*.spec.js'
  ],

  //used framework
  frameworks: ['jasmine'],

  plugins: [
    'karma-chrome-launcher',
    'karma-phantomjs-launcher',
    'karma-jasmine',
    'karma-coverage',
    'karma-html-reporter',
    'karma-mocha-reporter'
  ],

  preprocessors: {
    '**/client/src/**/*.js': 'coverage'
  },

  reporters: ['mocha', 'html', 'coverage'],

  coverageReporter: {
    type: 'html',
    dir: baseDir + '/test/unit-results/coverage',
    file: 'coverage.html'
  },

  htmlReporter: {
    outputDir: baseDir + '//test/unit-results/html'
  },

  logLevel: 'info',

  urlRoot: '/__test/',

      //used browsers (overriding in some gulp task)
  browsers: ['PhantomJS']
};

When I run gulp test:unit only loginService.spec.js test is runned. Somehow this loginController.spec.js test is not finding. I even tried in karma.config.js file to set whole path to this file

( baseDir + '/test/unit/modules/login/controllers/loginController.spec.js') 

but again test is not runned.

Here is my code structure:

enter image description here

Here is also piece of code from gulpfile.js for test:unit command which i not changed anything.

//run unit tests and exit
gulp.task('test:unit', ['build'], function(cb) {
  karma.start(_.assign({}, karmaConfig, {
    singleRun: true
  }), cb);
});

Aucun commentaire:

Enregistrer un commentaire