Matteo Scandolo | a86e0a1 | 2017-08-08 13:05:27 -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 | e19fa10 | 2017-03-09 15:38:59 -0800 | [diff] [blame] | 19 | const conf = require('./gulp.conf'); |
| 20 | |
| 21 | module.exports = function (config) { |
| 22 | const configuration = { |
| 23 | basePath: '../', |
| 24 | singleRun: true, |
| 25 | autoWatch: false, |
| 26 | logLevel: 'INFO', |
| 27 | junitReporter: { |
| 28 | outputDir: 'test-reports' |
| 29 | }, |
| 30 | browsers: [ |
| 31 | 'PhantomJS' |
| 32 | ], |
| 33 | frameworks: [ |
| 34 | 'jasmine', |
| 35 | 'es6-shim' |
| 36 | ], |
| 37 | files: [ |
| 38 | 'node_modules/es6-shim/es6-shim.js', |
| 39 | conf.path.src('index.spec.js'), |
| 40 | conf.path.src('**/*.html') |
| 41 | ], |
| 42 | preprocessors: { |
| 43 | [conf.path.src('index.spec.js')]: [ |
| 44 | 'webpack' |
| 45 | ], |
| 46 | [conf.path.src('**/*.html')]: [ |
| 47 | 'ng-html2js' |
| 48 | ] |
| 49 | }, |
| 50 | ngHtml2JsPreprocessor: { |
| 51 | stripPrefix: `${conf.paths.src}/` |
| 52 | }, |
| 53 | reporters: ['progress', 'coverage'], |
| 54 | coverageReporter: { |
| 55 | type: 'html', |
| 56 | dir: 'coverage/' |
| 57 | }, |
| 58 | webpack: require('./webpack-test.conf'), |
| 59 | webpackMiddleware: { |
| 60 | noInfo: true |
| 61 | }, |
| 62 | plugins: [ |
| 63 | require('karma-jasmine'), |
| 64 | require('karma-junit-reporter'), |
| 65 | require('karma-coverage'), |
| 66 | require('karma-phantomjs-launcher'), |
| 67 | require('karma-phantomjs-shim'), |
| 68 | require('karma-ng-html2js-preprocessor'), |
| 69 | require('karma-webpack'), |
| 70 | require('karma-es6-shim') |
| 71 | ] |
| 72 | }; |
| 73 | |
| 74 | config.set(configuration); |
| 75 | }; |