Matteo Scandolo | d2044a4 | 2017-08-07 16:08:28 -0700 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2017-present Open Networking Foundation |
| 4 | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | |
Matteo Scandolo | bba1d78 | 2016-07-12 15:56:23 -0700 | [diff] [blame] | 19 | // Karma configuration |
| 20 | // Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC) |
| 21 | |
| 22 | /* eslint indent: [2,2], quotes: [2, "single"]*/ |
| 23 | |
| 24 | /*eslint-disable*/ |
| 25 | var wiredep = require('wiredep'); |
| 26 | var path = require('path'); |
| 27 | |
| 28 | var bowerComponents = wiredep( {devDependencies: true} )[ 'js' ].map(function( file ){ |
| 29 | return path.relative(process.cwd(), file); |
| 30 | }); |
| 31 | |
Matteo Scandolo | 195dde9 | 2016-07-25 16:43:16 -0700 | [diff] [blame] | 32 | // dirty trick to load angular as first |
Matteo Scandolo | bba1d78 | 2016-07-12 15:56:23 -0700 | [diff] [blame] | 33 | var ngIndex = bowerComponents.findIndex((item) => { |
| 34 | return item === 'src/vendor/angular/angular.js'; |
| 35 | }); |
| 36 | |
| 37 | bowerComponents.splice(ngIndex, 1); |
| 38 | bowerComponents.unshift('src/vendor/angular/angular.js'); |
| 39 | // end dirty trick to load angular as first |
| 40 | |
| 41 | module.exports = function(config) { |
| 42 | /*eslint-enable*/ |
| 43 | config.set({ |
| 44 | |
| 45 | // base path that will be used to resolve all patterns (eg. files, exclude) |
| 46 | basePath: '', |
| 47 | |
| 48 | |
| 49 | // frameworks to use |
| 50 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter |
| 51 | frameworks: ['jasmine'], |
| 52 | |
| 53 | |
| 54 | // list of files / patterns to load in the browser |
| 55 | files: bowerComponents.concat([ |
Matteo Scandolo | 195dde9 | 2016-07-25 16:43:16 -0700 | [diff] [blame] | 56 | './src/vendor/ng-xos-lib/dist/ngXosVendor.min.js', |
| 57 | './src/vendor/ng-xos-lib/dist/ngXosHelpers.min.js', |
Matteo Scandolo | bba1d78 | 2016-07-12 15:56:23 -0700 | [diff] [blame] | 58 | 'src/js/main.js', |
| 59 | 'src/js/**/*.js', |
| 60 | 'spec/**/*.mock.js', |
| 61 | 'spec/**/*.test.js', |
| 62 | 'src/**/*.html' |
| 63 | ]), |
| 64 | |
| 65 | |
| 66 | // list of files to exclude |
| 67 | exclude: [ |
| 68 | ], |
| 69 | |
| 70 | |
| 71 | // preprocess matching files before serving them to the browser |
| 72 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor |
| 73 | preprocessors: { |
| 74 | 'src/js/**/*.js': ['babel'], |
| 75 | 'spec/**/*.test.js': ['babel'], |
Matteo Scandolo | 195dde9 | 2016-07-25 16:43:16 -0700 | [diff] [blame] | 76 | 'spec/**/*.mock.js': ['babel'], |
Matteo Scandolo | bba1d78 | 2016-07-12 15:56:23 -0700 | [diff] [blame] | 77 | 'src/**/*.html': ['ng-html2js'] |
| 78 | }, |
| 79 | |
| 80 | ngHtml2JsPreprocessor: { |
| 81 | 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) |
| 82 | moduleName: 'templates' // define the template module name |
| 83 | }, |
| 84 | |
| 85 | // test results reporter to use |
| 86 | // possible values: 'dots', 'progress' |
| 87 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter |
| 88 | reporters: ['mocha'], |
| 89 | |
| 90 | |
| 91 | // web server port |
| 92 | port: 9876, |
| 93 | |
| 94 | |
| 95 | // enable / disable colors in the output (reporters and logs) |
| 96 | colors: true, |
| 97 | |
| 98 | |
| 99 | // level of logging |
| 100 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
| 101 | logLevel: config.LOG_INFO, |
| 102 | |
| 103 | |
| 104 | // enable / disable watching file and executing tests whenever any file changes |
| 105 | autoWatch: true, |
| 106 | |
| 107 | |
| 108 | // start these browsers |
| 109 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher |
| 110 | browsers: ['PhantomJS'], |
| 111 | |
| 112 | |
| 113 | // Continuous Integration mode |
| 114 | // if true, Karma captures browsers, runs the tests and exits |
| 115 | singleRun: false |
| 116 | }); |
| 117 | }; |