]>
Commit | Line | Data |
---|---|---|
e6af0f60 SR |
1 | // Karma configuration |
2 | ||
2835616b PO |
3 | // The Safari launcher is broken, so construct our own |
4 | function SafariBrowser(id, baseBrowserDecorator, args) { | |
5 | baseBrowserDecorator(this); | |
6 | ||
7 | this._start = function(url) { | |
8 | this._execCommand('/usr/bin/open', ['-W', '-n', '-a', 'Safari', url]); | |
9 | } | |
10 | } | |
11 | ||
12 | SafariBrowser.prototype = { | |
13 | name: 'Safari' | |
14 | } | |
15 | ||
651c23ec | 16 | module.exports = (config) => { |
cdb860ad | 17 | let browsers = []; |
e6af0f60 | 18 | |
2835616b PO |
19 | if (process.env.TEST_BROWSER_NAME) { |
20 | browsers = process.env.TEST_BROWSER_NAME.split(','); | |
e6af0f60 SR |
21 | } |
22 | ||
cdb860ad | 23 | const my_conf = { |
e6af0f60 SR |
24 | |
25 | // base path that will be used to resolve all patterns (eg. files, exclude) | |
26 | basePath: '', | |
27 | ||
28 | // frameworks to use | |
29 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter | |
7bcdbbc6 | 30 | frameworks: ['mocha', 'sinon-chai'], |
e6af0f60 SR |
31 | |
32 | // list of files / patterns to load in the browser (loaded in order) | |
33 | files: [ | |
890cff92 PO |
34 | { pattern: 'app/localization.js', included: false, type: 'module' }, |
35 | { pattern: 'app/webutil.js', included: false, type: 'module' }, | |
36 | { pattern: 'core/**/*.js', included: false, type: 'module' }, | |
37 | { pattern: 'vendor/pako/**/*.js', included: false, type: 'module' }, | |
38 | { pattern: 'tests/test.*.js', type: 'module' }, | |
39 | { pattern: 'tests/fake.*.js', included: false, type: 'module' }, | |
40 | { pattern: 'tests/assertions.js', type: 'module' }, | |
e6af0f60 SR |
41 | ], |
42 | ||
43 | client: { | |
44 | mocha: { | |
dfae3209 SR |
45 | // replace Karma debug page with mocha display |
46 | 'reporter': 'html', | |
e6af0f60 SR |
47 | 'ui': 'bdd' |
48 | } | |
49 | }, | |
50 | ||
51 | // list of files to exclude | |
52 | exclude: [ | |
e6af0f60 SR |
53 | ], |
54 | ||
2835616b PO |
55 | plugins: [ |
56 | 'karma-*', | |
57 | '@chiragrupani/karma-chromium-edge-launcher', | |
58 | { 'launcher:Safari': [ 'type', SafariBrowser ] }, | |
59 | ], | |
e6af0f60 SR |
60 | |
61 | // start these browsers | |
62 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | |
63 | browsers: browsers, | |
64 | ||
e6af0f60 SR |
65 | // test results reporter to use |
66 | // possible values: 'dots', 'progress' | |
67 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter | |
dfae3209 | 68 | reporters: ['mocha'], |
e6af0f60 SR |
69 | |
70 | ||
e6af0f60 SR |
71 | // level of logging |
72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | |
73 | logLevel: config.LOG_INFO, | |
74 | ||
75 | ||
76 | // enable / disable watching file and executing tests whenever any file changes | |
77 | autoWatch: false, | |
78 | ||
79 | // Continuous Integration mode | |
80 | // if true, Karma captures browsers, runs the tests and exits | |
81 | singleRun: true, | |
e6af0f60 SR |
82 | }; |
83 | ||
e6af0f60 SR |
84 | config.set(my_conf); |
85 | }; |