]> git.proxmox.com Git - mirror_novnc.git/blame - karma.conf.js
Add support for Travis CI and SauceLabs Testing
[mirror_novnc.git] / karma.conf.js
CommitLineData
e6af0f60
SR
1// Karma configuration
2
3module.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 'include/util.js', // load first to avoid issues, since methods are called immediately
113 //'../include/*.js',
114 'include/base64.js',
115 'include/keysym.js',
116 'include/keysymdef.js',
117 'include/keyboard.js',
118 'include/input.js',
119 'include/websock.js',
120 'include/rfb.js',
121 'include/jsunzip.js',
122 'include/des.js',
123 'include/display.js',
124 'tests/test.*.js'
125 ],
126
127 client: {
128 mocha: {
129 'ui': 'bdd'
130 }
131 },
132
133 // list of files to exclude
134 exclude: [
135 '../include/playback.js',
136 '../include/ui.js'
137 ],
138
139 customLaunchers: customLaunchers,
140
141 // start these browsers
142 // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
143 browsers: browsers,
144
145 // preprocess matching files before serving them to the browser
146 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
147 preprocessors: {
148
149 },
150
151
152 // test results reporter to use
153 // possible values: 'dots', 'progress'
154 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
155 reporters: ['mocha', 'saucelabs'],
156
157
158 // web server port
159 port: 9876,
160
161
162 // enable / disable colors in the output (reporters and logs)
163 colors: true,
164
165
166 // level of logging
167 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
168 logLevel: config.LOG_INFO,
169
170
171 // enable / disable watching file and executing tests whenever any file changes
172 autoWatch: false,
173
174 // Continuous Integration mode
175 // if true, Karma captures browsers, runs the tests and exits
176 singleRun: true,
177
178 // Increase timeout in case connection is slow/we run more browsers than possible
179 // (we currently get 3 for free, and we try to run 7, so it can take a while)
180 captureTimeout: 240000
181 };
182
183 if (useSauce) {
184 my_conf.sauceLabs = {
185 testName: 'noVNC Tests (all)',
186 startConnect: true,
187 };
188 }
189
190 config.set(my_conf);
191};