-
Notifications
You must be signed in to change notification settings - Fork 14
/
karma.conf.js
134 lines (130 loc) · 3.12 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
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
const queryString = require('query-string')
const url = require('url')
const PORT = 9876
module.exports = (config) => {
config.set({
customLaunchers: {
bs_chrome_mac: {
base: 'BrowserStack',
browser: 'Chrome',
os: 'OS X',
os_version: 'Big Sur',
},
bs_firefox_mac: {
base: 'BrowserStack',
browser: 'Firefox',
os: 'OS X',
os_version: 'Big Sur',
},
bs_safari_mac: {
base: 'BrowserStack',
browser: 'Safari',
os: 'OS X',
os_version: 'Big Sur',
},
bs_edge_win: {
base: 'BrowserStack',
browser: 'Edge',
os: 'Windows',
os_version: '10',
},
bs_ie_win: {
base: 'BrowserStack',
browser: 'IE',
os: 'Windows',
os_version: '10',
},
},
browsers: [
'bs_chrome_mac',
'bs_firefox_mac',
'bs_safari_mac',
'bs_edge_win',
'bs_ie_win',
],
autoWatch: true,
client: {
mocha: {
timeout: 10000,
ui: 'tdd',
},
},
colors: true,
concurrency: Infinity,
coverageIstanbulReporter: {
combineBrowserReports: true,
dir: path.join(__dirname, 'coverage'),
fixWebpackSourcePaths: true,
reports: ['lcov', 'text'],
},
files: [
'node_modules/sinon/pkg/sinon.js',
{
pattern: 'test/fixtures/*',
watched: false,
included: false,
},
'test/index.ts',
],
frameworks: ['mocha', 'chai'],
logLevel: config.LOG_ERROR,
port: PORT,
preprocessors: {
'test/index.ts': ['webpack', 'sourcemap'],
},
proxies: {
'/fixtures/': `http://localhost:${PORT}/base/test/fixtures/`,
},
reporters: ['spec', 'coverage-istanbul', 'BrowserStack'],
singleRun: true,
webpack: {
devtool: 'inline-source-map',
mode: 'development',
module: {
rules: [
{
test: require.resolve('prettier'),
use: 'null-loader',
},
{
test: /\.(ts|js)$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/typescript'],
},
},
},
{
test: /\.ts$/,
exclude: [path.resolve(__dirname, 'test')],
enforce: 'post',
use: {
loader: 'babel-loader',
options: { plugins: ['istanbul'] },
},
},
],
},
resolve: {
extensions: ['.json', '.js', '.ts'],
fallback: {
fs: 'empty',
module: 'empty',
},
},
},
proxyRes(proxyRes, req) {
const { search } = url.parse(req.url)
const parsed = queryString.parse(search)
const contentType = parsed['content-type']
if (contentType === 'missing') {
delete proxyRes.headers['content-type']
} else if (contentType) {
proxyRes.headers['content-type'] = contentType
}
},
})
}