]> git.proxmox.com Git - mirror_novnc.git/blob - karma.conf.js
feat: add French localization strings
[mirror_novnc.git] / karma.conf.js
1 // Karma configuration
2
3 module.exports = (config) => {
4 const customLaunchers = {};
5 let browsers = [];
6 let useSauce = false;
7
8 // use Sauce when running on Travis
9 if (process.env.TRAVIS_JOB_NUMBER) {
10 useSauce = true;
11 }
12
13 if (useSauce && process.env.TEST_BROWSER_NAME && process.env.TEST_BROWSER_NAME != 'PhantomJS') {
14 const names = process.env.TEST_BROWSER_NAME.split(',');
15 const platforms = process.env.TEST_BROWSER_OS.split(',');
16 const versions = process.env.TEST_BROWSER_VERSION
17 ? process.env.TEST_BROWSER_VERSION.split(',')
18 : [null];
19
20 for (let i = 0; i < names.length; i++) {
21 for (let j = 0; j < platforms.length; j++) {
22 for (let k = 0; k < versions.length; k++) {
23 let launcher_name = 'sl_' + platforms[j].replace(/[^a-zA-Z0-9]/g, '') + '_' + names[i];
24 if (versions[k]) {
25 launcher_name += '_' + versions[k];
26 }
27
28 customLaunchers[launcher_name] = {
29 base: 'SauceLabs',
30 browserName: names[i],
31 platform: platforms[j],
32 };
33
34 if (versions[i]) {
35 customLaunchers[launcher_name].version = versions[k];
36 }
37 }
38 }
39 }
40
41 browsers = Object.keys(customLaunchers);
42 } else {
43 useSauce = false;
44 //browsers = ['PhantomJS'];
45 browsers = [];
46 }
47
48 const my_conf = {
49
50 // base path that will be used to resolve all patterns (eg. files, exclude)
51 basePath: '',
52
53 // frameworks to use
54 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
55 frameworks: ['mocha', 'sinon-chai'],
56
57 // list of files / patterns to load in the browser (loaded in order)
58 files: [
59 { pattern: 'app/localization.js', included: false },
60 { pattern: 'app/webutil.js', included: false },
61 { pattern: 'core/**/*.js', included: false },
62 { pattern: 'vendor/pako/**/*.js', included: false },
63 { pattern: 'vendor/browser-es-module-loader/dist/*.js*', included: false },
64 { pattern: 'tests/test.*.js', included: false },
65 { pattern: 'tests/fake.*.js', included: false },
66 { pattern: 'tests/assertions.js', included: false },
67 'vendor/promise.js',
68 'tests/karma-test-main.js',
69 ],
70
71 client: {
72 mocha: {
73 // replace Karma debug page with mocha display
74 'reporter': 'html',
75 'ui': 'bdd'
76 }
77 },
78
79 // list of files to exclude
80 exclude: [
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 // test results reporter to use
90 // possible values: 'dots', 'progress'
91 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
92 reporters: ['mocha'],
93
94
95 // web server port
96 port: 9876,
97
98
99 // enable / disable colors in the output (reporters and logs)
100 colors: true,
101
102
103 // level of logging
104 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
105 logLevel: config.LOG_INFO,
106
107
108 // enable / disable watching file and executing tests whenever any file changes
109 autoWatch: false,
110
111 // Continuous Integration mode
112 // if true, Karma captures browsers, runs the tests and exits
113 singleRun: true,
114
115 // Increase timeout in case connection is slow/we run more browsers than possible
116 // (we currently get 3 for free, and we try to run 7, so it can take a while)
117 captureTimeout: 240000,
118
119 // similarly to above
120 browserNoActivityTimeout: 100000,
121 };
122
123 if (useSauce) {
124 my_conf.reporters.push('saucelabs');
125 my_conf.captureTimeout = 0; // use SL timeout
126 my_conf.sauceLabs = {
127 testName: 'noVNC Tests (all)',
128 startConnect: false,
129 tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
130 };
131 }
132
133 config.set(my_conf);
134 };