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