Matteo Scandolo | bba1d78 | 2016-07-12 15:56:23 -0700 | [diff] [blame] | 1 | // Karma configuration |
| 2 | // Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC) |
| 3 | |
| 4 | /* eslint indent: [2,2], quotes: [2, "single"]*/ |
| 5 | |
| 6 | /*eslint-disable*/ |
| 7 | var wiredep = require('wiredep'); |
| 8 | var path = require('path'); |
| 9 | |
| 10 | var bowerComponents = wiredep( {devDependencies: true} )[ 'js' ].map(function( file ){ |
| 11 | return path.relative(process.cwd(), file); |
| 12 | }); |
| 13 | |
Matteo Scandolo | 195dde9 | 2016-07-25 16:43:16 -0700 | [diff] [blame] | 14 | // dirty trick to load angular as first |
Matteo Scandolo | bba1d78 | 2016-07-12 15:56:23 -0700 | [diff] [blame] | 15 | var ngIndex = bowerComponents.findIndex((item) => { |
| 16 | return item === 'src/vendor/angular/angular.js'; |
| 17 | }); |
| 18 | |
| 19 | bowerComponents.splice(ngIndex, 1); |
| 20 | bowerComponents.unshift('src/vendor/angular/angular.js'); |
| 21 | // end dirty trick to load angular as first |
| 22 | |
| 23 | module.exports = function(config) { |
| 24 | /*eslint-enable*/ |
| 25 | config.set({ |
| 26 | |
| 27 | // base path that will be used to resolve all patterns (eg. files, exclude) |
| 28 | basePath: '', |
| 29 | |
| 30 | |
| 31 | // frameworks to use |
| 32 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter |
| 33 | frameworks: ['jasmine'], |
| 34 | |
| 35 | |
| 36 | // list of files / patterns to load in the browser |
| 37 | files: bowerComponents.concat([ |
Matteo Scandolo | 195dde9 | 2016-07-25 16:43:16 -0700 | [diff] [blame] | 38 | './src/vendor/ng-xos-lib/dist/ngXosVendor.min.js', |
| 39 | './src/vendor/ng-xos-lib/dist/ngXosHelpers.min.js', |
Matteo Scandolo | bba1d78 | 2016-07-12 15:56:23 -0700 | [diff] [blame] | 40 | 'src/js/main.js', |
| 41 | 'src/js/**/*.js', |
| 42 | 'spec/**/*.mock.js', |
| 43 | 'spec/**/*.test.js', |
| 44 | 'src/**/*.html' |
| 45 | ]), |
| 46 | |
| 47 | |
| 48 | // list of files to exclude |
| 49 | exclude: [ |
| 50 | ], |
| 51 | |
| 52 | |
| 53 | // preprocess matching files before serving them to the browser |
| 54 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor |
| 55 | preprocessors: { |
| 56 | 'src/js/**/*.js': ['babel'], |
| 57 | 'spec/**/*.test.js': ['babel'], |
Matteo Scandolo | 195dde9 | 2016-07-25 16:43:16 -0700 | [diff] [blame] | 58 | 'spec/**/*.mock.js': ['babel'], |
Matteo Scandolo | bba1d78 | 2016-07-12 15:56:23 -0700 | [diff] [blame] | 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 | }; |