Add new code new version
[sdc.git] / openecomp-ui / karma.conf.js
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 var path = require('path');
22 var isparta = require('isparta');
23
24 module.exports = function (config) {
25         config.set({
26
27                 browsers: [process.env.JENKINS_HOME ? 'Firefox' : 'Chrome'],
28
29                 singleRun: true,
30
31                 autoWatchBatchDelay: 50,
32
33                 frameworks: ['mocha'],
34
35                 files: [
36                         'tests.webpack.js'
37                 ],
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                         devtool: 'inline-source-map',
68                         resolve: {
69                                 root: [path.resolve('.')],
70                                 alias: {
71                                         i18nJson: 'nfvo-utils/i18n/locale.json',
72                                         'nfvo-utils/RestAPIUtil.js': 'test-utils/MockRest.js',
73                                         'nfvo-utils': 'src/nfvo-utils',
74                                         'nfvo-components': 'src/nfvo-components',
75                                         'sdc-app': 'src/sdc-app'
76                                 }
77                         },
78                         module: {
79                                 preLoaders: [
80                                         {test: /\.js$/, exclude: /(src|node_modules)/, loader: 'eslint-loader'},
81                                         {test: /\.(js|jsx)$/, exclude: /(test|test\.js|node_modules)/, loader: 'isparta'}
82                                 ],
83                                 loaders: [
84                                         {test: /\.(js|jsx)$/, exclude: /node_modules/, loader: 'babel-loader'},
85                                         {test: /\.json$/, loaders: ['json']},
86                                         {test: /\.(css|scss|png|jpg|svg|ttf|eot|otf|woff|woff2)(\?.*)?$/, loader: 'ignore-loader'},
87                                 ]
88                         },
89                         eslint: {
90                                 configFile: './.eslintrc',
91                                 emitError: true,
92                                 emitWarning: true,
93                                 failOnError: true
94                         },
95                 },
96
97                 webpackServer: {
98                         noInfo: true
99                 }
100
101         });
102 };