]> git.proxmox.com Git - mirror_novnc.git/blob - karma.conf.js
Merge pull request #496 from kanaka/refactor/modularized
[mirror_novnc.git] / karma.conf.js
1 // Karma configuration
2
3 module.exports = function(config) {
4 /*var customLaunchers = {
5 sl_chrome_win7: {
6 base: 'SauceLabs',
7 browserName: 'chrome',
8 platform: 'Windows 7'
9 },
10
11 sl_firefox30_linux: {
12 base: 'SauceLabs',
13 browserName: 'firefox',
14 version: '30',
15 platform: 'Linux'
16 },
17
18 sl_firefox26_linux: {
19 base: 'SauceLabs',
20 browserName: 'firefox',
21 version: 26,
22 platform: 'Linux'
23 },
24
25 sl_windows7_ie10: {
26 base: 'SauceLabs',
27 browserName: 'internet explorer',
28 platform: 'Windows 7',
29 version: '10'
30 },
31
32 sl_windows81_ie11: {
33 base: 'SauceLabs',
34 browserName: 'internet explorer',
35 platform: 'Windows 8.1',
36 version: '11'
37 },
38
39 sl_osxmavericks_safari7: {
40 base: 'SauceLabs',
41 browserName: 'safari',
42 platform: 'OS X 10.9',
43 version: '7'
44 },
45
46 sl_osxmtnlion_safari6: {
47 base: 'SauceLabs',
48 browserName: 'safari',
49 platform: 'OS X 10.8',
50 version: '6'
51 }
52 };*/
53
54 var customLaunchers = {};
55 var browsers = [];
56 var useSauce = false;
57
58 if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) {
59 useSauce = true;
60 }
61
62 if (useSauce && process.env.TEST_BROWSER_NAME && process.env.TEST_BROWSER_NAME != 'PhantomJS') {
63 var names = process.env.TEST_BROWSER_NAME.split(',');
64 var platforms = process.env.TEST_BROWSER_OS.split(',');
65 var versions = [];
66 if (process.env.TEST_BROWSER_VERSION) {
67 versions = process.env.TEST_BROWSER_VERSION.split(',');
68 } else {
69 versions = [null];
70 }
71
72 for (var i = 0; i < names.length; i++) {
73 for (var j = 0; j < platforms.length; j++) {
74 for (var k = 0; k < versions.length; k++) {
75 var launcher_name = 'sl_' + platforms[j].replace(/[^a-zA-Z0-9]/g, '') + '_' + names[i];
76 if (versions[k]) {
77 launcher_name += '_' + versions[k];
78 }
79
80 customLaunchers[launcher_name] = {
81 base: 'SauceLabs',
82 browserName: names[i],
83 platform: platforms[j],
84 };
85
86 if (versions[i]) {
87 customLaunchers[launcher_name].version = versions[k];
88 }
89 }
90 }
91 }
92
93 browsers = Object.keys(customLaunchers);
94 } else {
95 useSauce = false;
96 browsers = ['PhantomJS'];
97 }
98
99 var my_conf = {
100
101 // base path that will be used to resolve all patterns (eg. files, exclude)
102 basePath: '',
103
104 // frameworks to use
105 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
106 frameworks: ['mocha', 'sinon', 'chai', 'sinon-chai'],
107
108
109 // list of files / patterns to load in the browser (loaded in order)
110 files: [
111 'tests/fake.*.js',
112 'tests/assertions.js',
113 'core/util.js', // load first to avoid issues, since methods are called immediately
114 //'../core/*.js',
115 'core/base64.js',
116 'core/input/keysym.js',
117 'core/input/keysymdef.js',
118 'core/input/xtscancodes.js',
119 'core/input/util.js',
120 'core/input/devices.js',
121 'core/websock.js',
122 'core/rfb.js',
123 'core/des.js',
124 'core/display.js',
125 'core/inflator.js',
126 'tests/test.*.js'
127 ],
128
129 client: {
130 mocha: {
131 'ui': 'bdd'
132 }
133 },
134
135 // list of files to exclude
136 exclude: [
137 '../tests/playback.js',
138 '../app/ui.js'
139 ],
140
141 customLaunchers: customLaunchers,
142
143 // start these browsers
144 // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
145 browsers: browsers,
146
147 // preprocess matching files before serving them to the browser
148 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
149 preprocessors: {
150
151 },
152
153
154 // test results reporter to use
155 // possible values: 'dots', 'progress'
156 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
157 reporters: ['mocha', 'saucelabs'],
158
159
160 // web server port
161 port: 9876,
162
163
164 // enable / disable colors in the output (reporters and logs)
165 colors: true,
166
167
168 // level of logging
169 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
170 logLevel: config.LOG_INFO,
171
172
173 // enable / disable watching file and executing tests whenever any file changes
174 autoWatch: false,
175
176 // Continuous Integration mode
177 // if true, Karma captures browsers, runs the tests and exits
178 singleRun: true,
179
180 // Increase timeout in case connection is slow/we run more browsers than possible
181 // (we currently get 3 for free, and we try to run 7, so it can take a while)
182 captureTimeout: 240000,
183
184 // similarly to above
185 browserNoActivityTimeout: 100000,
186 };
187
188 if (useSauce) {
189 my_conf.captureTimeout = 0; // use SL timeout
190 my_conf.sauceLabs = {
191 testName: 'noVNC Tests (all)',
192 startConnect: false,
193 tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
194 };
195 }
196
197 config.set(my_conf);
198 };