-
Notifications
You must be signed in to change notification settings - Fork 2
/
karma.conf.js
47 lines (42 loc) · 1.41 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
const Encore = require('@symfony/webpack-encore');
Encore.configureRuntimeEnvironment('dev');
const encoreConfig = require('./webpack-encore-config');
const webpackConfig = encoreConfig('tests/Functional/App/var/karma/build').getWebpackConfig();
delete webpackConfig.entry;
delete webpackConfig.optimization.runtimeChunk;
delete webpackConfig.optimization.splitChunks;
// Replace the mini-css-extract-plugin's loader by the style-loader
const styleExtensions = ['/\\.css$/', '/\\.s[ac]ss$/', '/\\.less$/', '/\\.styl$/'];
for (const rule of webpackConfig.module.rules) {
if (rule.test && rule.oneOf && styleExtensions.includes(rule.test.toString())) {
rule.oneOf.forEach((oneOf) => {
oneOf.use[0] = 'style-loader';
})
}
}
// Karma options
module.exports = function(config) {
config.set({
frameworks: ['jasmine-ajax', 'jasmine', 'webpack'],
browserConsoleLogOptions: {
level: 'log',
terminal: false //Remove console.* logs
},
files: [
'tests/assets/js/main.js'
],
preprocessors: {
'tests/assets/js/main.js': ['webpack']
},
webpackMiddleware: {
stats: 'errors-only',
noInfo: true,
},
browsers: ['Firefox'],
reporters: ['spec'],
specReporter: {
suppressPassed: true,
},
webpack: webpackConfig
});
};