blob: e62295b66ad5ea4ed6b29260888e31c59fbcd945 [file] [log] [blame]
Matteo Scandolo686547a2017-08-08 13:05:25 -07001
2/*
3 * Copyright 2017-present Open Networking Foundation
4
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8
9 * http://www.apache.org/licenses/LICENSE-2.0
10
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
Matteo Scandoloa5d03d52016-07-21 11:35:46 -070019/*eslint-env node */
20(function () {
21 'use strict';
22 // Karma configuration
23 // Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC)
24
25 /* eslint indent: [2,2], quotes: [2, "single"]*/
26
27 // this is to load a different suite of test while developing
Arpit Agarwal441284b2016-08-04 17:12:55 -070028 let testFiles = '*';
Matteo Scandoloa5d03d52016-07-21 11:35:46 -070029 if(process.argv[4]){
30 testFiles = process.argv[4];
31 }
32
33 /*eslint-disable*/
34 const wiredep = require('wiredep');
35 const path = require('path');
36
37 const bowerComponents = wiredep({
38 devDependencies: true,
39 exclude: [ /bootstrap-sass/],
40 })[ 'js' ]
41 .map(function( file ){
42 return path.relative(process.cwd(), file);
43 });
44
45 const files = bowerComponents.concat([
46 'node_modules/babel-polyfill/dist/polyfill.js',
47 'src/**/*.module.js',
48 'src/**/*.js',
49 `spec/test_helpers.js`,
50 `spec/**/${testFiles}.test.js`
51 ]);
52
53 module.exports = function(config) {
54 /*eslint-enable*/
55 config.set({
56
57 // base path that will be used to resolve all patterns (eg. files, exclude)
58 basePath: '',
59
60
61 // frameworks to use
62 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
63 frameworks: ['jasmine'],
64
65
66 // list of files / patterns to load in the browser
67 files: files,
68
69
70 // list of files to exclude
71 exclude: [
72 ],
73
74
75 // preprocess matching files before serving them to the browser
76 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
77 preprocessors: {
78 'src/**/*.js': ['babel'],
79 'spec/**/*.js': ['babel'],
80 },
81
82 babelPreprocessor: {
83 options: {
84 presets: ['es2015'],
85 sourceMap: 'both'
86 },
87 filename: function (file) {
88 return file.originalPath;
89 },
90 },
91
92 //ngHtml2JsPreprocessor: {
93 // stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js)
94 // moduleName: 'templates' // define the template module name
95 //},
96
97 // test results reporter to use
98 // possible values: 'dots', 'progress'
99 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
100 reporters: ['mocha'],
101
102
103 // web server port
104 port: 9876,
105
106
107 // enable / disable colors in the output (reporters and logs)
108 colors: true,
109
110
111 // level of logging
112 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
113 logLevel: config.LOG_INFO,
114
115
116 // enable / disable watching file and executing tests whenever any file changes
117 autoWatch: true,
118
119
120 // start these browsers
121 // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
122 browsers: [
123 'PhantomJS',
Matteo Scandoloe57712f2016-09-21 15:27:36 -0700124 //'Chrome'
Matteo Scandoloa5d03d52016-07-21 11:35:46 -0700125 ],
126
127
128 // Continuous Integration mode
129 // if true, Karma captures browsers, runs the tests and exits
130 singleRun: false
131 });
132 };
133})();