Matteo Scandolo | fb46ae6 | 2017-08-08 09:10:50 -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 | d819c92 | 2016-12-02 14:06:14 -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: [ |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 34 | 'jasmine', |
| 35 | 'es6-shim' |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 36 | ], |
| 37 | files: [ |
| 38 | 'node_modules/es6-shim/es6-shim.js', |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 39 | conf.path.src('index.spec.js'), |
| 40 | conf.path.src('**/*.html') |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 41 | ], |
| 42 | preprocessors: { |
| 43 | [conf.path.src('index.spec.js')]: [ |
| 44 | 'webpack' |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 45 | ], |
| 46 | [conf.path.src('**/*.html')]: [ |
| 47 | 'ng-html2js' |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 48 | ] |
| 49 | }, |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 50 | ngHtml2JsPreprocessor: { |
| 51 | stripPrefix: `${conf.paths.src}/` |
| 52 | }, |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 53 | reporters: ['progress', 'coverage'], |
| 54 | coverageReporter: { |
Matteo Scandolo | 70377e5 | 2017-04-10 16:41:28 -0700 | [diff] [blame] | 55 | // type: 'html', |
| 56 | dir: 'coverage/', |
| 57 | reporters: [ |
| 58 | {type: 'json', subdir: '.'}, |
| 59 | {type: 'html', subdir: 'html'}, |
| 60 | {type: 'cobertura', subdir: '.'} |
| 61 | ] |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 62 | }, |
| 63 | webpack: require('./webpack-test.conf'), |
| 64 | webpackMiddleware: { |
| 65 | noInfo: true |
| 66 | }, |
| 67 | plugins: [ |
| 68 | require('karma-jasmine'), |
| 69 | require('karma-junit-reporter'), |
| 70 | require('karma-coverage'), |
| 71 | require('karma-phantomjs-launcher'), |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 72 | require('karma-phantomjs-shim'), |
| 73 | require('karma-ng-html2js-preprocessor'), |
| 74 | require('karma-webpack'), |
| 75 | require('karma-es6-shim') |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 76 | ] |
| 77 | }; |
| 78 | |
| 79 | config.set(configuration); |
| 80 | }; |