Matteo Scandolo | fb0ac9e | 2016-07-12 15:56:23 -0700 | [diff] [blame] | 1 | 'use strict'; |
| 2 | // Karma configuration |
| 3 | // Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC) |
| 4 | |
| 5 | /* eslint indent: [2,2], quotes: [2, "single"]*/ |
| 6 | |
| 7 | /*eslint-disable*/ |
| 8 | var wiredep = require('wiredep'); |
| 9 | var path = require('path'); |
| 10 | |
| 11 | var bowerComponents = wiredep( {devDependencies: true} )[ 'js' ].map(function( file ){ |
| 12 | return path.relative(process.cwd(), file); |
| 13 | }); |
| 14 | |
| 15 | // dirt trick to load angular as first |
| 16 | var ngIndex = bowerComponents.findIndex((item) => { |
| 17 | return item === 'src/vendor/angular/angular.js'; |
| 18 | }); |
| 19 | |
| 20 | bowerComponents.splice(ngIndex, 1); |
| 21 | bowerComponents.unshift('src/vendor/angular/angular.js'); |
| 22 | // end dirty trick to load angular as first |
| 23 | |
| 24 | module.exports = function(config) { |
| 25 | /*eslint-enable*/ |
| 26 | config.set({ |
| 27 | |
| 28 | // base path that will be used to resolve all patterns (eg. files, exclude) |
| 29 | basePath: '', |
| 30 | |
| 31 | |
| 32 | // frameworks to use |
| 33 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter |
| 34 | frameworks: ['jasmine'], |
| 35 | |
| 36 | |
| 37 | // list of files / patterns to load in the browser |
| 38 | files: bowerComponents.concat([ |
| 39 | '../../../xos/core/xoslib/static/js/vendor/ngXosVendor.js', |
| 40 | '../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js', |
| 41 | 'src/js/main.js', |
| 42 | 'src/js/**/*.js', |
| 43 | 'spec/**/*.mock.js', |
| 44 | 'spec/**/*.test.js', |
| 45 | 'src/**/*.html' |
| 46 | ]), |
| 47 | |
| 48 | |
| 49 | // list of files to exclude |
| 50 | exclude: [ |
| 51 | ], |
| 52 | |
| 53 | |
| 54 | // preprocess matching files before serving them to the browser |
| 55 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor |
| 56 | preprocessors: { |
| 57 | 'src/js/**/*.js': ['babel'], |
| 58 | 'spec/**/*.test.js': ['babel'], |
| 59 | 'src/**/*.html': ['ng-html2js'] |
| 60 | }, |
| 61 | |
| 62 | ngHtml2JsPreprocessor: { |
| 63 | stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js) |
| 64 | moduleName: 'templates' // define the template module name |
| 65 | }, |
| 66 | |
| 67 | // test results reporter to use |
| 68 | // possible values: 'dots', 'progress' |
| 69 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter |
| 70 | reporters: ['mocha'], |
| 71 | |
| 72 | |
| 73 | // web server port |
| 74 | port: 9876, |
| 75 | |
| 76 | |
| 77 | // enable / disable colors in the output (reporters and logs) |
| 78 | colors: true, |
| 79 | |
| 80 | |
| 81 | // level of logging |
| 82 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
| 83 | logLevel: config.LOG_INFO, |
| 84 | |
| 85 | |
| 86 | // enable / disable watching file and executing tests whenever any file changes |
| 87 | autoWatch: true, |
| 88 | |
| 89 | |
| 90 | // start these browsers |
| 91 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher |
| 92 | browsers: ['PhantomJS'], |
| 93 | |
| 94 | |
| 95 | // Continuous Integration mode |
| 96 | // if true, Karma captures browsers, runs the tests and exits |
| 97 | singleRun: false |
| 98 | }); |
| 99 | }; |