Simon Hunt | 449630f | 2014-12-09 11:40:00 -0800 | [diff] [blame] | 1 | // Karma configuration |
Simon Hunt | 449630f | 2014-12-09 11:40:00 -0800 | [diff] [blame] | 2 | |
| 3 | module.exports = function(config) { |
| 4 | config.set({ |
| 5 | |
| 6 | // base path that will be used to resolve all patterns (eg. files, exclude) |
Simon Hunt | 5d12dc2 | 2015-01-05 16:56:22 -0800 | [diff] [blame] | 7 | // the path is relative to this (karma.conf.js) file |
Simon Hunt | 449630f | 2014-12-09 11:40:00 -0800 | [diff] [blame] | 8 | basePath: '', |
| 9 | |
| 10 | |
| 11 | // frameworks to use |
| 12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter |
| 13 | frameworks: ['jasmine'], |
| 14 | |
| 15 | |
| 16 | // list of files / patterns to load in the browser |
| 17 | files: [ |
Simon Hunt | f306972 | 2014-12-16 18:15:37 -0800 | [diff] [blame] | 18 | // library code... |
Steven Burrows | 9145867 | 2017-08-16 11:53:38 +0100 | [diff] [blame] | 19 | '../vendor/angular/angular.min.js', |
| 20 | '../vendor/angular-mocks/index.js', |
| 21 | '../vendor/angular-route/angular-route.min.js', |
| 22 | '../vendor/angular-cookies/angular-cookies.min.js', |
| 23 | '../vendor/d3/d3.min.js', |
| 24 | '../vendor/topojson/topojson.js', |
| 25 | '../vendor/Chart.js/dist/Chart.min.js', |
| 26 | '../vendor/angular-chart.js/dist/angular-chart.min.js', |
| 27 | '../vendor/lodash/index.js', |
Simon Hunt | f306972 | 2014-12-16 18:15:37 -0800 | [diff] [blame] | 28 | |
| 29 | // production code... |
Simon Hunt | dc6362a | 2014-12-18 19:55:23 -0800 | [diff] [blame] | 30 | // make sure modules are defined first... |
Simon Hunt | 7c7dd3e | 2015-02-27 11:42:18 -0800 | [diff] [blame] | 31 | '../onos.js', |
Simon Hunt | 737c89f | 2015-01-28 12:23:19 -0800 | [diff] [blame] | 32 | |
Simon Hunt | dc6362a | 2014-12-18 19:55:23 -0800 | [diff] [blame] | 33 | '../app/fw/util/util.js', |
Simon Hunt | 7ac7be9 | 2015-01-06 10:47:56 -0800 | [diff] [blame] | 34 | '../app/fw/svg/svg.js', |
Simon Hunt | e672044 | 2015-01-15 12:21:06 -0800 | [diff] [blame] | 35 | '../app/fw/remote/remote.js', |
Bri Prebilic Cole | 093739a | 2015-01-23 10:22:50 -0800 | [diff] [blame] | 36 | '../app/fw/widget/widget.js', |
Simon Hunt | 988934e | 2015-01-23 11:49:24 -0800 | [diff] [blame] | 37 | '../app/fw/layer/layer.js', |
Simon Hunt | 737c89f | 2015-01-28 12:23:19 -0800 | [diff] [blame] | 38 | |
| 39 | '../app/view/topo/topo.js', |
| 40 | |
Simon Hunt | dc6362a | 2014-12-18 19:55:23 -0800 | [diff] [blame] | 41 | // now load services etc. that augment the modules |
| 42 | '../app/**/*.js', |
Simon Hunt | f306972 | 2014-12-16 18:15:37 -0800 | [diff] [blame] | 43 | |
| 44 | // unit test code... |
Simon Hunt | dc6362a | 2014-12-18 19:55:23 -0800 | [diff] [blame] | 45 | 'app/*-spec.js', |
Matteo Scandolo | 231c754 | 2016-05-20 11:13:11 -0700 | [diff] [blame] | 46 | 'app/**/*-spec.js', |
| 47 | |
| 48 | // server mock |
| 49 | './server.mock.js' |
Simon Hunt | 449630f | 2014-12-09 11:40:00 -0800 | [diff] [blame] | 50 | ], |
| 51 | |
| 52 | |
| 53 | // list of files to exclude |
| 54 | exclude: [ |
Steven Burrows | 72a354f | 2016-10-10 15:57:39 -0500 | [diff] [blame] | 55 | '../app/view/topo2/node_modules/**/*' |
Simon Hunt | 449630f | 2014-12-09 11:40:00 -0800 | [diff] [blame] | 56 | ], |
| 57 | |
| 58 | |
| 59 | // preprocess matching files before serving them to the browser |
| 60 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor |
| 61 | preprocessors: { |
Steven Burrows | db3be6f | 2017-07-11 22:44:31 +0100 | [diff] [blame] | 62 | '../app/**/*.js': 'coverage' |
Simon Hunt | 449630f | 2014-12-09 11:40:00 -0800 | [diff] [blame] | 63 | }, |
| 64 | |
| 65 | |
| 66 | // test results reporter to use |
| 67 | // possible values: 'dots', 'progress' |
| 68 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter |
Steven Burrows | db3be6f | 2017-07-11 22:44:31 +0100 | [diff] [blame] | 69 | reporters: ['mocha', 'coverage'], |
| 70 | coverageReport: { |
| 71 | type: 'html', |
| 72 | dir : 'coverage/' |
| 73 | }, |
Simon Hunt | 449630f | 2014-12-09 11:40:00 -0800 | [diff] [blame] | 74 | |
| 75 | // web server port |
| 76 | port: 9876, |
| 77 | |
| 78 | |
| 79 | // enable / disable colors in the output (reporters and logs) |
| 80 | colors: true, |
| 81 | |
| 82 | |
| 83 | // level of logging |
| 84 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
| 85 | logLevel: config.LOG_INFO, |
| 86 | |
| 87 | |
| 88 | // enable / disable watching file and executing tests whenever any file changes |
| 89 | autoWatch: true, |
| 90 | |
| 91 | |
| 92 | // start these browsers |
| 93 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher |
Matteo Scandolo | 6602db8 | 2016-04-19 18:12:45 -0700 | [diff] [blame] | 94 | browsers: ['PhantomJS'], |
Simon Hunt | 449630f | 2014-12-09 11:40:00 -0800 | [diff] [blame] | 95 | |
| 96 | |
| 97 | // Continuous Integration mode |
| 98 | // if true, Karma captures browsers, runs the tests and exits |
| 99 | singleRun: false |
| 100 | }); |
| 101 | }; |