Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [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 | |
Matteo Scandolo | 5697e45 | 2016-05-04 17:22:45 -0700 | [diff] [blame] | 6 | // this is to load a different suite of test while developing |
| 7 | var testFiles = '*'; |
| 8 | if(process.argv[4]){ |
| 9 | testFiles = process.argv[4]; |
| 10 | } |
| 11 | |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 12 | /*eslint-disable*/ |
| 13 | var wiredep = require('wiredep'); |
| 14 | var path = require('path'); |
| 15 | |
| 16 | var bowerComponents = wiredep({devDependencies: true})[ 'js' ].map(function( file ){ |
| 17 | return path.relative(process.cwd(), file); |
| 18 | }); |
| 19 | |
Matteo Scandolo | 061094b | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 20 | var files = bowerComponents.concat([ |
Matteo Scandolo | 9f0e5ae | 2016-04-20 12:24:52 -0700 | [diff] [blame] | 21 | 'node_modules/babel-polyfill/dist/polyfill.js', |
Matteo Scandolo | cc6954e | 2016-04-15 12:20:14 -0700 | [diff] [blame] | 22 | 'xosHelpers/src/**/*.module.js', |
Matteo Scandolo | 061094b | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 23 | 'xosHelpers/src/**/*.js', |
Matteo Scandolo | 5697e45 | 2016-05-04 17:22:45 -0700 | [diff] [blame] | 24 | `xosHelpers/spec/**/${testFiles}.test.js` |
Matteo Scandolo | 061094b | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 25 | ]); |
| 26 | |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 27 | module.exports = function(config) { |
| 28 | /*eslint-enable*/ |
| 29 | config.set({ |
| 30 | |
| 31 | // base path that will be used to resolve all patterns (eg. files, exclude) |
| 32 | basePath: '', |
| 33 | |
| 34 | |
| 35 | // frameworks to use |
| 36 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter |
| 37 | frameworks: ['jasmine'], |
| 38 | |
| 39 | |
| 40 | // list of files / patterns to load in the browser |
Matteo Scandolo | 061094b | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 41 | files: files, |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 42 | |
| 43 | |
| 44 | // list of files to exclude |
| 45 | exclude: [ |
| 46 | ], |
| 47 | |
| 48 | |
| 49 | // preprocess matching files before serving them to the browser |
| 50 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor |
| 51 | preprocessors: { |
Matteo Scandolo | 9e6c6fc | 2016-04-14 14:59:09 -0700 | [diff] [blame] | 52 | 'xosHelpers/**/*.js': ['babel'], |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 53 | }, |
| 54 | |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 55 | babelPreprocessor: { |
| 56 | options: { |
| 57 | presets: ['es2015'], |
Matteo Scandolo | a952467 | 2016-04-26 16:34:56 -0700 | [diff] [blame] | 58 | sourceMap: 'both' |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 59 | }, |
| 60 | filename: function (file) { |
| 61 | return file.originalPath; |
| 62 | }, |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 63 | }, |
| 64 | |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 65 | //ngHtml2JsPreprocessor: { |
| 66 | // 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) |
| 67 | // moduleName: 'templates' // define the template module name |
| 68 | //}, |
| 69 | |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 70 | // test results reporter to use |
| 71 | // possible values: 'dots', 'progress' |
| 72 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter |
| 73 | reporters: ['mocha'], |
| 74 | |
| 75 | |
| 76 | // web server port |
| 77 | port: 9876, |
| 78 | |
| 79 | |
| 80 | // enable / disable colors in the output (reporters and logs) |
| 81 | colors: true, |
| 82 | |
| 83 | |
| 84 | // level of logging |
| 85 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
Matteo Scandolo | ba1d35c | 2016-04-26 10:10:54 -0700 | [diff] [blame] | 86 | logLevel: config.LOG_INFO, |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 87 | |
| 88 | |
| 89 | // enable / disable watching file and executing tests whenever any file changes |
| 90 | autoWatch: true, |
| 91 | |
| 92 | |
| 93 | // start these browsers |
| 94 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher |
Matteo Scandolo | a952467 | 2016-04-26 16:34:56 -0700 | [diff] [blame] | 95 | browsers: [ |
| 96 | 'PhantomJS', |
Matteo Scandolo | dd11d7c | 2016-06-14 17:26:51 -0700 | [diff] [blame] | 97 | //'Chrome' |
Matteo Scandolo | a952467 | 2016-04-26 16:34:56 -0700 | [diff] [blame] | 98 | ], |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 99 | |
| 100 | |
| 101 | // Continuous Integration mode |
| 102 | // if true, Karma captures browsers, runs the tests and exits |
| 103 | singleRun: false |
| 104 | }); |
| 105 | }; |