-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkarma.conf.js
81 lines (78 loc) · 1.79 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
const path = require('path');
const ESLintPlugin = require('eslint-webpack-plugin');
module.exports = function(config) {
let conf = {
basePath: "",
frameworks: ['mocha', 'chai'],
files: [
'test/main.js',
{ pattern: 'test/img/*', included: false, served: true }
],
plugins : [
'karma-mocha',
'karma-chai',
'karma-mocha-reporter',
'karma-chrome-launcher',
'karma-coverage-istanbul-reporter',
'karma-webpack',
'karma-sourcemap-loader'
],
preprocessors: {
'test/main.js': ['webpack', 'sourcemap']
},
webpack: {
watch: false,
mode: 'none',
devtool: 'inline-source-map',
plugins: [new ESLintPlugin({ failOnError: true })],
module: {
rules: [
{
test: /\.js$/,
include: [
path.resolve('src')
],
loader: '@jsdevtools/coverage-istanbul-loader',
options: {
esModules: true
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
}
},
logLevel: config.LOG_ERROR,
reporters: ['mocha', 'coverage-istanbul'],
browsers : ['Chrome'],
browserConsoleLogOptions: {
terminal: true,
level: ""
},
customLaunchers: {
ChromeActions: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
coverageIstanbulReporter: {
reports: [process.env.GITHUB_ACTIONS? 'lcov': 'html'],
dir : 'coverage/'
},
client: {
mocha: {
timeout: 10000
}
},
singleRun: true,
colors: true,
port: 9999
};
if(process.env.GITHUB_ACTIONS){
conf.browsers = ['ChromeActions'];
}
config.set(conf);
};