forked from sweetalert2/sweetalert2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
142 lines (137 loc) · 3.25 KB
/
karma.conf.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
const isCi = require('is-ci')
const noLaunch = process.argv.includes('--no-launch')
const isWindows = process.platform === 'win32'
const testMinified = process.argv.includes('--minified')
const isSauce = process.argv.includes('--sauce')
module.exports = function (config) {
const sauceLabsLaunchers = {
safari: {
base: 'SauceLabs',
browserName: 'Safari',
version: 'latest',
// TODO(@limonte): remove this line, the current latest 10.14 doesn't work (#1349)
platform: 'macOS 10.13'
},
edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
version: 'latest'
},
iphone: {
base: 'SauceLabs',
browserName: 'Safari',
deviceName: 'iPhone Simulator',
platformName: 'iOS',
platformVersion: 'latest'
},
android: {
base: 'SauceLabs',
deviceName: 'Android GoogleAPI Emulator',
browserName: 'Chrome',
platformName: 'Android',
platformVersion: 'latest'
}
}
let browsers = []
let files
if (testMinified) {
files = [
'dist/sweetalert2.all.min.js'
]
} else {
files = [
'dist/sweetalert2.css',
'dist/sweetalert2.js'
]
}
files = files.concat([
'node_modules/promise-polyfill/dist/polyfill.min.js',
'test/qunit/**/*.js'
])
const reporters = ['spec', 'saucelabs']
if (!noLaunch) {
// Cron on Travis or check:qunit --sauce
if (isSauce) {
if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
console.error('SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables must be set')
process.exit(1)
}
browsers = Object.keys(sauceLabsLaunchers)
} else if (isCi) {
// AppVeyor
if (isWindows) {
browsers = ['IE', 'ChromeHeadless', 'FirefoxHeadless']
// Travis
} else {
browsers = ['ChromeHeadless', 'FirefoxHeadless']
if (!testMinified) {
reporters.push('coverage')
}
}
} else {
// Local development
browsers = ['ChromeHeadless']
reporters.push('coverage')
}
}
config.set({
port: 3000,
frameworks: [
'qunit'
],
qunit: {
reorder: false
},
customLaunchers: sauceLabsLaunchers,
browsers,
reporters,
preprocessors: {
'test/qunit/**/*.js': [
'webpack',
'sourcemap'
],
'dist/*.js': [
'coverage'
]
},
coverageReporter: {
dir: 'coverage',
reporters: [
{ type: 'html', subdir: '.' },
{ type: 'lcov', subdir: '.' }
]
},
files,
webpack: {
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|dist)/,
use: {
loader: 'babel-loader',
options: {/* babel options */}
}
}
]
}
},
webpackMiddleware: {
stats: 'errors-only'
},
plugins: [
'karma-coverage',
'karma-webpack',
'karma-qunit',
'karma-spec-reporter',
'karma-sourcemap-loader',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-ie-launcher',
'karma-sauce-launcher'
],
captureTimeout: 360000,
browserNoActivityTimeout: 360000
})
}