b23b582f7c16df3d94cd37840a2b24c03cdfa7e3
[aai/sparky-fe.git] / karma.conf.js
1 /*
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017 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  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 var path = require('path');
24 var webpack = require('webpack');
25 var isparta = require('isparta');
26
27 module.exports = function (config) {
28         config.set({
29
30                 browsers: [process.env.CONTINUOUS_INTEGRATION ? 'Firefox' : 'Chrome'],
31
32                 singleRun: true,
33
34                 frameworks: ['mocha'],
35
36                 files: ['tests.webpack.js'],
37
38                 preprocessors: {
39                         'tests.webpack.js': ['webpack', 'sourcemap'],
40                         'src/**/*.jsx': ['coverage']
41                 },
42
43                 reporters: ['progress', 'coverage'],
44
45                 coverageReporter: {
46                         dir: 'dist/coverage/',
47                         reporters: [
48                                 {type: 'html'},
49                                 {type: 'text-summary'}
50                         ],
51                         includeAllSources: true,
52                         instrumenters: {isparta: isparta},
53                         instrumenter: {
54                                 '**/*.js': 'isparta',
55                                 '**/*.jsx': 'isparta'
56                         },
57                         instrumenterOptions: {
58                                 isparta: {
59                                         embedSource: true,
60                                         noAutoWrap: true
61                                 }
62                         }
63                 },
64
65                 webpack: {
66                         babel: {
67                                 presets: ['es2015', 'stage-0', 'react']
68                         },
69                         isparta: {
70                                 embedSource: true,
71                                 noAutoWrap: true,
72                                 // these babel options will be passed only to isparta and not to babel-loader
73                                 babel: {
74                                         presets: ['es2015', 'stage-0', 'react']
75                                 }
76                         },
77                         devtool: 'inline-source-map',
78                         resolve: {
79                                 root: [path.resolve('.')],
80                                 alias: {
81                                         app: 'src/app',
82                                         'generic-components': 'src/generic-components',
83                                         utils: 'src/utils',
84                                         'test-utils': 'test/utils'
85                                 }
86                         },
87                         module: {
88                                 preLoaders: [
89                                         {test: /\.(js|jsx)$/, exclude: /node_modules/, loader: 'babel-loader'},
90                                         {test: /\.(js|jsx)$/, exclude: /(test|test\.js|node_modules)/, loader: 'isparta'}
91                                 ],
92                                 loaders: [
93                                         {test: /\.css$/, loaders: ['style', 'css', 'resolve-url']},
94                                         {test: /\.scss$/, loaders: ['style', 'css', 'resolve-url', 'sass?sourceMap']},
95                                         // required for font icons
96                                         {test: /\.(woff|woff2)(\?.*)?$/, loader: 'url-loader?limit=16384&mimetype=application/font-woff'},
97                                         {test: /\.(ttf|eot|otf)(\?.*)?$/, loader: 'file-loader'},
98                                         {test: /\.(png|jpg|svg)(\?.*)?$/, loader: 'url-loader?limit=16384'},
99
100                                         {test: /\.json$/, loaders: ['json']}
101                                 ]
102                         }
103                 },
104
105                 webpackServer: {
106                         noInfo: true
107                 }
108
109         });
110 };