]> git.proxmox.com Git - mirror_novnc.git/blob - karma.conf.js
Add Spanish translation
[mirror_novnc.git] / karma.conf.js
1 // Karma configuration
2
3 module.exports = function(config) {
4 var customLaunchers = {};
5 var browsers = [];
6 var 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 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;
47 //browsers = ['PhantomJS'];
48 browsers = [];
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
58 frameworks: ['requirejs', 'mocha', 'chai'],
59
60 // list of files / patterns to load in the browser (loaded in order)
61 files: [
62 { pattern: 'vendor/sinon.js', included: false },
63 { pattern: 'node_modules/sinon-chai/lib/sinon-chai.js', included: false },
64 { pattern: 'app/localization.js', included: false },
65 { pattern: 'core/**/*.js', included: false },
66 { pattern: 'vendor/pako/**/*.js', included: false },
67 { pattern: 'tests/test.*.js', included: false },
68 { pattern: 'tests/fake.*.js', included: false },
69 { pattern: 'tests/assertions.js', included: false },
70 'tests/karma-test-main.js',
71 ],
72
73 client: {
74 mocha: {
75 // replace Karma debug page with mocha display
76 'reporter': 'html',
77 'ui': 'bdd'
78 }
79 },
80
81 // list of files to exclude
82 exclude: [
83 ],
84
85 customLaunchers: customLaunchers,
86
87 // start these browsers
88 // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
89 browsers: browsers,
90
91 // preprocess matching files before serving them to the browser
92 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
93 preprocessors: {
94 'app/localization.js': ['babel'],
95 'core/**/*.js': ['babel'],
96 'tests/test.*.js': ['babel'],
97 'tests/fake.*.js': ['babel'],
98 'tests/assertions.js': ['babel'],
99 'vendor/pako/**/*.js': ['babel'],
100 },
101
102 babelPreprocessor: {
103 options: {
104 plugins: ['transform-es2015-modules-amd', 'syntax-dynamic-import'],
105 sourceMap: 'inline',
106 },
107 },
108
109 // test results reporter to use
110 // possible values: 'dots', 'progress'
111 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
112 reporters: ['mocha'],
113
114
115 // web server port
116 port: 9876,
117
118
119 // enable / disable colors in the output (reporters and logs)
120 colors: true,
121
122
123 // level of logging
124 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
125 logLevel: config.LOG_INFO,
126
127
128 // enable / disable watching file and executing tests whenever any file changes
129 autoWatch: false,
130
131 // Continuous Integration mode
132 // if true, Karma captures browsers, runs the tests and exits
133 singleRun: true,
134
135 // Increase timeout in case connection is slow/we run more browsers than possible
136 // (we currently get 3 for free, and we try to run 7, so it can take a while)
137 captureTimeout: 240000,
138
139 // similarly to above
140 browserNoActivityTimeout: 100000,
141 };
142
143 if (useSauce) {
144 my_conf.reporters.push('saucelabs');
145 my_conf.captureTimeout = 0; // use SL timeout
146 my_conf.sauceLabs = {
147 testName: 'noVNC Tests (all)',
148 startConnect: false,
149 tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
150 };
151 }
152
153 config.set(my_conf);
154 };