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