-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathkarma.conf.js
81 lines (78 loc) · 2.59 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
/* eslint-disable no-undef,no-process-env,no-underscore-dangle,no-global-assign,no-native-reassign */
// noinspection NpmUsedModulesInstalled
process = require('process');
process.env.CHROME_BIN = require('puppeteer').executablePath();
const path = require('path');
// don't preprocess files on debug run
// if (!process.env._INTELLIJ_KARMA_INTERNAL_PARAMETER_debug && !process.argv.includes('--debug')) {
// reporters.push('coverage-istanbul');
// }
module.exports = function(config) {
config.set({
basePath: 'js/',
frameworks: [ 'jasmine', 'webpack' ],
files: [
{ pattern: 'test/*.test.js', type: 'module' },
{ pattern: 'test/helpers/*.js', type: 'module', included: false },
{ pattern: 'test/fixtures/*.html', included: false },
{ pattern: 'src/**/*.js', type: 'module', included: false }
],
exclude: [],
preprocessors: {
'test/*.test.js': [ 'webpack', 'sourcemap' ],
'test/helpers/*.js': [ 'webpack', 'sourcemap' ],
'src/**/*.js': [ 'sourcemap' ]
},
coverageIstanbulReporter: {
reports: [ 'html', 'text-summary', 'lcovonly' ],
dir: path.join(__dirname, 'coverage'),
fixWebpackSourcePaths: true,
'report-config': {
html: { outdir: 'html' }
}
},
// possible values: 'dots', 'progress'
reporters: [ 'progress', 'coverage-istanbul' ],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [ 'ChromeHeadless' ],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// how many browser should be started simultaneous
concurrency: Infinity,
// webpack
webpack: {
mode: 'development',
devtool: 'inline-source-map',
watch: true,
module: {
rules: [
{
test: /\.js$/,
include: path.resolve('js/src/'),
use: {
loader: '@jsdevtools/coverage-istanbul-loader',
options: { esModules: true }
}
},
{
resourceQuery: /raw/,
type: 'asset/source'
}
]
}
},
webpackMiddleware: {
noInfo: true
}
})
};