-
Notifications
You must be signed in to change notification settings - Fork 445
Expand file tree
/
Copy pathtestConfig.js
More file actions
173 lines (161 loc) · 5.1 KB
/
testConfig.js
File metadata and controls
173 lines (161 loc) · 5.1 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
const nodePath = require('path');
const webpack = require('webpack');
const ProvidePlugin = require("webpack/lib/ProvidePlugin");
const {
VERSION_INFO_DEFINE_PLUGIN
} = require('./BuildUtils');
module.exports = ({browsers = [ 'ChromeHeadless' ], files, path, testFile, singleRun, basePath = ".", alias = {}}) => ({
browsers,
browserNoActivityTimeout: 30000,
reportSlowerThan: 100,
singleRun,
frameworks: [ 'mocha', 'webpack' ],
basePath,
files: [
...files,
// add all assets needed for Cesium library
{ pattern: './node_modules/cesium/Build/CesiumUnminified/**/*', included: false },
{ pattern: './node_modules/web-ifc/**/*', included: false }
],
proxies: {
"/web-ifc/": "/base/node_modules/web-ifc/"
},
plugins: [
require('karma-chrome-launcher'),
'karma-webpack',
'karma-mocha',
'karma-mocha-reporter',
'karma-coverage',
'karma-coveralls',
'karma-junit-reporter',
'karma-firefox-launcher'
],
preprocessors: {
[testFile]: [ 'webpack' ]
},
reporters: [ 'mocha', 'coverage' ],
junitReporter: {
outputDir: './web/target/karma-tests-results',
suite: ''
},
coverageReporter: {
dir: './coverage/',
reporters: [
{ type: 'html', subdir: 'report-html' },
{ type: 'cobertura', subdir: '.', file: 'cobertura.txt' },
{ type: 'lcovonly', subdir: '.' }
],
instrumenterOptions: {
istanbul: { noCompact: true }
}
},
browserConsoleLogOptions: {
terminal: true,
level: 'DEBUG'
},
webpack: {
devtool: 'eval',
mode: 'development',
optimization: {
nodeEnv: false
},
output: {
hashFunction: "xxhash64"
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [{
loader: 'babel-loader',
options: {
configFile: nodePath.join(__dirname, 'babel.config.js')
}
}],
include: path
},
{
test: /\.css$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}]
},
{
test: /\.less$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}, {
loader: 'less-loader'
}]
},
{
test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/,
use: [{
loader: 'url-loader',
options: {
mimetype: "application/font-woff"
}
}]
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9].[0-9].[0-9])?$/,
use: [{
loader: 'file-loader',
options: {
name: "[name].[ext]"
}
}]
},
{
test: /\.(png|jpg|gif|svg)$/,
use: [{
loader: 'url-loader',
options: {
name: "[path][name].[ext]",
limit: 8192
}
}] // inline base64 URLs for <=8k images, direct URLs for the rest
}
]
},
resolve: {
fallback: {
timers: false,
stream: false,
http: false,
https: false,
zlib: false
},
alias: Object.assign({}, {
// next libs are added because of this issue https://github.com/geosolutions-it/MapStore2/issues/4569
"react-joyride": '@geosolutions/react-joyride'
}, alias),
extensions: ['.js', '.json', '.jsx']
},
plugins: [
new ProvidePlugin({
Buffer: ['buffer', 'Buffer']
}),
// needed complete env object for cesium tests
new webpack.DefinePlugin({
process: { env: { 'NODE_ENV': JSON.stringify('development') } }
}),
new webpack.DefinePlugin({
'__MAPSTORE_PROJECT_CONFIG__': JSON.stringify({})
}),
new webpack.DefinePlugin({
// Define relative base path in cesium for loading assets
'CESIUM_BASE_URL': JSON.stringify('base/node_modules/cesium/Build/CesiumUnminified')
}),
VERSION_INFO_DEFINE_PLUGIN
]
},
webpackServer: {
noInfo: true
}
});