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