]> git.proxmox.com Git - mirror_novnc.git/blame - karma.conf.js
Update browser test list
[mirror_novnc.git] / karma.conf.js
CommitLineData
e6af0f60
SR
1// Karma configuration
2
3module.exports = function(config) {
e6af0f60
SR
4 var customLaunchers = {};
5 var browsers = [];
6 var useSauce = false;
7
b081ea72
SR
8 // use Sauce when running on Travis
9 if (process.env.TRAVIS_JOB_NUMBER) {
e6af0f60
SR
10 useSauce = true;
11 }
12
13 if (useSauce && process.env.TEST_BROWSER_NAME && process.env.TEST_BROWSER_NAME != 'PhantomJS') {
14 var names = process.env.TEST_BROWSER_NAME.split(',');
15 var platforms = process.env.TEST_BROWSER_OS.split(',');
16 var versions = [];
17 if (process.env.TEST_BROWSER_VERSION) {
18 versions = process.env.TEST_BROWSER_VERSION.split(',');
19 } else {
20 versions = [null];
21 }
22
23 for (var i = 0; i < names.length; i++) {
24 for (var j = 0; j < platforms.length; j++) {
25 for (var k = 0; k < versions.length; k++) {
26 var launcher_name = 'sl_' + platforms[j].replace(/[^a-zA-Z0-9]/g, '') + '_' + names[i];
27 if (versions[k]) {
28 launcher_name += '_' + versions[k];
29 }
30
31 customLaunchers[launcher_name] = {
32 base: 'SauceLabs',
33 browserName: names[i],
34 platform: platforms[j],
35 };
36
37 if (versions[i]) {
38 customLaunchers[launcher_name].version = versions[k];
39 }
40 }
41 }
42 }
43
44 browsers = Object.keys(customLaunchers);
45 } else {
46 useSauce = false;
dfae3209
SR
47 //browsers = ['PhantomJS'];
48 browsers = [];
e6af0f60
SR
49 }
50
51 var my_conf = {
52
53 // base path that will be used to resolve all patterns (eg. files, exclude)
54 basePath: '',
55
56 // frameworks to use
57 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
dfae3209 58 frameworks: ['requirejs', 'mocha', 'chai'],
e6af0f60
SR
59
60 // list of files / patterns to load in the browser (loaded in order)
61 files: [
dfae3209
SR
62 { pattern: 'vendor/sinon.js', included: false },
63 { pattern: 'node_modules/sinon-chai/lib/sinon-chai.js', included: false },
7279364c 64 { pattern: 'app/localization.js', included: false },
e0750f9b 65 { pattern: 'app/webutil.js', included: false },
dfae3209
SR
66 { pattern: 'core/**/*.js', included: false },
67 { pattern: 'vendor/pako/**/*.js', included: false },
68 { pattern: 'tests/test.*.js', included: false },
69 { pattern: 'tests/fake.*.js', included: false },
70 { pattern: 'tests/assertions.js', included: false },
71 'tests/karma-test-main.js',
e6af0f60
SR
72 ],
73
74 client: {
75 mocha: {
dfae3209
SR
76 // replace Karma debug page with mocha display
77 'reporter': 'html',
e6af0f60
SR
78 'ui': 'bdd'
79 }
80 },
81
82 // list of files to exclude
83 exclude: [
e6af0f60
SR
84 ],
85
86 customLaunchers: customLaunchers,
87
88 // start these browsers
89 // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
90 browsers: browsers,
91
92 // preprocess matching files before serving them to the browser
93 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
94 preprocessors: {
7279364c 95 'app/localization.js': ['babel'],
e0750f9b 96 'app/webutil.js': ['babel'],
dfae3209
SR
97 'core/**/*.js': ['babel'],
98 'tests/test.*.js': ['babel'],
99 'tests/fake.*.js': ['babel'],
100 'tests/assertions.js': ['babel'],
101 'vendor/pako/**/*.js': ['babel'],
e6af0f60
SR
102 },
103
dfae3209
SR
104 babelPreprocessor: {
105 options: {
106 plugins: ['transform-es2015-modules-amd', 'syntax-dynamic-import'],
107 sourceMap: 'inline',
108 },
109 },
e6af0f60
SR
110
111 // test results reporter to use
112 // possible values: 'dots', 'progress'
113 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
dfae3209 114 reporters: ['mocha'],
e6af0f60
SR
115
116
117 // web server port
118 port: 9876,
119
120
121 // enable / disable colors in the output (reporters and logs)
122 colors: true,
123
124
125 // level of logging
126 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
127 logLevel: config.LOG_INFO,
128
129
130 // enable / disable watching file and executing tests whenever any file changes
131 autoWatch: false,
132
133 // Continuous Integration mode
134 // if true, Karma captures browsers, runs the tests and exits
135 singleRun: true,
136
137 // Increase timeout in case connection is slow/we run more browsers than possible
138 // (we currently get 3 for free, and we try to run 7, so it can take a while)
20d3fb66
SR
139 captureTimeout: 240000,
140
141 // similarly to above
142 browserNoActivityTimeout: 100000,
e6af0f60
SR
143 };
144
145 if (useSauce) {
dfae3209 146 my_conf.reporters.push('saucelabs');
f0e4548b 147 my_conf.captureTimeout = 0; // use SL timeout
e6af0f60
SR
148 my_conf.sauceLabs = {
149 testName: 'noVNC Tests (all)',
7e161007 150 startConnect: false,
f0e4548b 151 tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
e6af0f60
SR
152 };
153 }
154
155 config.set(my_conf);
156};