-
Notifications
You must be signed in to change notification settings - Fork 18
/
karma.conf.js
52 lines (47 loc) · 1.25 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
/* eslint-disable */
var path = require('path');
var pkg = require('./package.json');
var REPORTER = process.env.REPORTER || (process.env.ENVIRONMENT==='ci' && 'junit') || '';
module.exports = function(config) {
config.set({
browsers: ['ChromeHeadless'],
frameworks: ['mocha', 'chai-sinon'],
reporters: ['mocha'].concat(REPORTER.split(/[, ]/)).filter(dedupe),
junitReporter: {
outputDir: 'test-reports', // results will be saved as $outputDir/$browserName.xml
suite: require('./package.json').name
},
mochaReporter: { showDiff: true },
files: [
'test/**/*.js'
],
preprocessors: {
'{src,test}/**/*': ['webpack', 'sourcemap']
},
webpack: {
mode: 'development',
devtool: 'inline-source-map',
resolve: {
alias: {
'preact-i18n': path.resolve(__dirname, process.env.TEST_PRODUCTION ? pkg.main : 'src')
}
},
module: {
rules: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: [ '@babel/env' ],
plugins: [
['@babel/plugin-transform-react-jsx', { pragma: 'h' }]
]
}
}]
},
},
webpackServer: { stats: 'errors-only' }
});
};
// filters out empties && dupes
function dedupe(v, i, arr) { return v && arr.indexOf(v)===i; }