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