Merge "Fixing failing test + covarage improvement"
[aai/sparky-fe.git] / karma.conf.js
1 /*
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21 var path = require('path');
22 var webpack = require('webpack');
23 var isparta = require('isparta');
24
25 module.exports = function (config) {
26         config.set({
27
28                 browsers: [process.env.CONTINUOUS_INTEGRATION ? 'Firefox' : 'Chrome'],
29
30                 singleRun: true,
31
32                 frameworks: ['mocha'],
33
34                 files: ['tests.webpack.js'],
35
36                 preprocessors: {
37                         'tests.webpack.js': ['webpack', 'sourcemap'],
38                         'src/**/*.jsx': ['coverage']
39                 },
40
41                 reporters: ['progress', 'coverage'],
42
43                 coverageReporter: {
44                         dir: 'dist/coverage/',
45                         reporters: [
46                                 {type: 'html'},
47                                 {type: 'text-summary'}
48                         ],
49                         includeAllSources: true,
50                         instrumenters: {isparta: isparta},
51                         instrumenter: {
52                                 '**/*.js': 'isparta',
53                                 '**/*.jsx': 'isparta'
54                         },
55                         instrumenterOptions: {
56                                 isparta: {
57                                         embedSource: true,
58                                         noAutoWrap: true
59                                 }
60                         }
61                 },
62
63                 webpack: {
64                         babel: {
65                                 presets: ['es2015', 'stage-0', 'react']
66                         },
67                         isparta: {
68                                 embedSource: true,
69                                 noAutoWrap: true,
70                                 // these babel options will be passed only to isparta and not to babel-loader
71                                 babel: {
72                                         presets: ['es2015', 'stage-0', 'react']
73                                 }
74                         },
75                         devtool: 'inline-source-map',
76                         resolve: {
77                                 root: [path.resolve('.')],
78                                 alias: {
79                                         app: 'src/app',
80                                         'generic-components': 'src/generic-components',
81                                         utils: 'src/utils',
82                                         'test-utils': 'test/utils'
83                                 }
84                         },
85                         module: {
86                                 preLoaders: [
87                                         {test: /\.(js|jsx)$/, exclude: /node_modules/, loader: 'babel-loader'},
88                                         {test: /\.(js|jsx)$/, exclude: /(test|test\.js|node_modules)/, loader: 'isparta'}
89                                 ],
90                                 loaders: [
91                                         {test: /\.css$/, loaders: ['style', 'css', 'resolve-url']},
92                                         {test: /\.scss$/, loaders: ['style', 'css', 'resolve-url', 'sass?sourceMap']},
93                                         // required for font icons
94                                         {test: /\.(woff|woff2)(\?.*)?$/, loader: 'url-loader?limit=16384&mimetype=application/font-woff'},
95                                         {test: /\.(ttf|eot|otf)(\?.*)?$/, loader: 'file-loader'},
96                                         {test: /\.(png|jpg|svg)(\?.*)?$/, loader: 'url-loader?limit=16384'},
97
98                                         {test: /\.json$/, loaders: ['json']}
99                                 ]
100                         }
101                 },
102
103                 webpackServer: {
104                         noInfo: true
105                 }
106
107         });
108 };