forked from openlayers/openlayers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.config.js
146 lines (141 loc) · 4.1 KB
/
karma.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* eslint-env node, es6 */
const path = require('path');
const pkg = require('../package.json');
/**
* The config below is not enough to run Karma. In addition, we need to add
* all library files in dependency order. This could be done with a plugin if
* Karma supported async plugins (there may be other alternatives as well). But
* for now we start Karma with the `tasks/test.js` script. This script
* sorts dependencies and adds files to the Karma config below.
*/
module.exports = function(karma) {
karma.set({
frameworks: ['mocha'],
client: {
runInParent: true,
mocha: {
timeout: 2500
}
},
files: [
{
pattern: path.resolve(__dirname, require.resolve('url-polyfill/url-polyfill.js')),
watched: false
},
{
pattern: 'module-global.js',
watched: false
}, {
pattern: path.resolve(__dirname, require.resolve('jquery/dist/jquery.js')),
watched: false
}, {
pattern: path.resolve(__dirname, require.resolve('expect.js/index.js')),
watched: false
}, {
pattern: path.resolve(__dirname, require.resolve('sinon/pkg/sinon.js')),
watched: false
}, {
pattern: path.resolve(__dirname, require.resolve('proj4/dist/proj4.js')),
watched: false
}, {
pattern: path.resolve(__dirname, require.resolve('pixelmatch/index.js')),
watched: false
}, {
pattern: path.resolve(__dirname, './test-extensions.js')
}, {
pattern: '**/*.test.js'
}, {
pattern: '**/*',
included: false,
watched: false
}
],
proxies: {
'/rendering/': '/base/rendering/',
'/spec/': '/base/spec/'
},
reporters: ['progress'],
coverageReporter: {
reporters: [
{
type: 'lcov', // produces HTML output and lcov
dir: '../coverage/',
subdir: '.'
},
{
type: 'text-summary' // prints the textual summary to the terminal
}
]
}
});
if (process.env.TRAVIS) {
const testName = process.env.TRAVIS_PULL_REQUEST ?
`https://github.com/openlayers/openlayers/pull/${process.env.TRAVIS_PULL_REQUEST}` :
`${pkg.name}@${pkg.version} (${process.env.TRAVIS_COMMIT})`;
// see https://wiki.saucelabs.com/display/DOCS/Platform+Configurator
// for platform and browserName options (Selenium API, node.js code)
const customLaunchers = {
SL_Chrome: {
base: 'SauceLabs',
browserName: 'chrome'
},
SL_Firefox: {
base: 'SauceLabs',
browserName: 'firefox'
},
SL_Edge: {
base: 'SauceLabs',
platform: 'Windows 10',
browserName: 'MicrosoftEdge'
},
SL_Safari: {
base: 'SauceLabs',
platform: 'macOS 10.12',
browserName: 'safari'
}
};
karma.set({
sauceLabs: {
testName: testName,
recordScreenshots: false,
startConnect: true,
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
username: 'openlayers',
accessKey: process.env.SAUCE_ACCESS_KEY,
connectOptions: {
noSslBumpDomains: 'all'
}
},
hostname: 'travis.dev',
reporters: ['dots', 'saucelabs', 'coverage'],
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 1,
captureTimeout: 240000,
browserNoActivityTimeout: 240000,
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
preprocessors: {
// source files, that you wanna generate coverage for
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'../src/**/*.js': ['coverage']
},
coverageReporter: {
reporters: [
{
type: 'lcovonly', // that's enough for coveralls, no HTML
dir: '../coverage/',
subdir: '.'
},
{
type: 'text-summary' // prints the textual summary to the terminal
}
]
}
});
} else {
karma.set({
browsers: ['Chrome']
});
}
};