blob: 834214fa89d4f5fe1f4a71fd9e2e9604a0fd9bb1 [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
22 'use strict';
23
24 // Karma configuration
25 // Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC)
26
27 const babelPreset = require('babel-preset-es2015');
28
29 /*eslint-disable*/
30
31 var files = [
32 'node_modules/babel-polyfill/dist/polyfill.js',
33
34
35 // loading jquery (it's used in tests)
36 `./bower_components/jquery/dist/jquery.js`,
37 `./bower_components/jasmine-jquery/lib/jasmine-jquery.js`,
38
39 // loading helpers and vendors
40 `./dist/ngXosVendor.min.js`,
41 `./dist/ngXosHelpers.min.js`,
42
43 // loading ngMock
44 `./bower_components/angular-mocks/angular-mocks.js`,
45 ]
46 .concat([
47 // loading tests
48 `spec/test_helpers.js`,
49 'spec/**/*.test.js'
50 ]);
51
52 module.exports = function(config) {
53 /*eslint-enable*/
54 config.set({
55
56 // base path that will be used to resolve all patterns (eg. files, exclude)
57 basePath: '',
58
59
60 // frameworks to use
61 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
62 frameworks: ['jasmine'],
63
64
65 // list of files / patterns to load in the browser
66 files: files,
67
68
69 // list of files to exclude
70 exclude: [
71 ],
72
73
74 // preprocess matching files before serving them to the browser
75 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
76 preprocessors: {
77 './spec/**/*.test.js': ['babel'],
78 './spec/test_helpers.js': ['babel'],
79 },
80
81 babelPreprocessor: {
82 options: {
83 presets: [babelPreset],
84 sourceMap: 'inline'
85 }
86 },
87
88 //ngHtml2JsPreprocessor: {
89 // 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)
90 // moduleName: 'templates' // define the template module name
91 //},
92
93 // test results reporter to use
94 // possible values: 'dots', 'progress'
95 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
96 reporters: ['dots', 'junit', 'coverage'],
97
98 junitReporter: {
99 outputDir: 'test-result',
100 useBrowserName: false,
101 outputFile: 'test-results.xml'
102 },
103
104 coverageReporter: {
105 type: 'cobertura',
106 subdir: '.',
107 dir: 'test-result/'
108 },
109
110 // web server port
111 port: 9876,
112
113
114 // enable / disable colors in the output (reporters and logs)
115 colors: true,
116
117
118 // level of logging
119 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
120 logLevel: config.LOG_INFO,
121
122
123 // enable / disable watching file and executing tests whenever any file changes
124 autoWatch: false,
125
126
127 // start these browsers
128 // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
129 browsers: [
130 'PhantomJS',
131 // 'Chrome'
132 ],
133
134
135 // Continuous Integration mode
136 // if true, Karma captures browsers, runs the tests and exits
137 singleRun: true
138 });
139 };
140
141})();