-
Notifications
You must be signed in to change notification settings - Fork 11
/
karma.conf.js
62 lines (59 loc) · 1.6 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
const webpack = require('webpack')
module.exports = function (config) {
const configuration = {
browserNoActivityTimeout: 120000,
frameworks: ['mocha'],
files: [
'./build/src/*.spec.js'
],
preprocessors: {
'./build/src//*.spec.js': ['webpack', 'env']
},
webpack : {
mode: "production",
devtool: 'inline-source-map',
module: {
// Suppress warning from mocha: "Critical dependency: the request of a dependency is an expression"
// @see https://webpack.js.org/configuration/module/#module-contexts
exprContextCritical: false
},
// Suppress fatal error: Cannot resolve module 'fs'
// @relative https://github.com/pugjs/pug-loader/issues/8
// @see https://github.com/webpack/docs/wiki/Configuration#node
node: {
fs: 'empty',
bindings: 'empty'
},
resolve: {
extensions: ['.ts', '.js', '.json']
}, plugins: [ new webpack.NormalModuleReplacementPlugin(
/\.\/index/,
'./build/src/bromwser.js'
),
],
},
singleRun: true,
reporters: ['mocha'],
plugins: [
'karma-chrome-launcher',
'karma-env-preprocessor',
'karma-webpack',
'karma-mocha',
'karma-mocha-reporter'
],
mime: {
'text/x-typescript': ['ts','tsx']
},
browsers: ['Chrome'],
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}
};
if(process.env.TRAVIS) {
configuration.browsers = ['Chrome_travis_ci'];
}
config.set(configuration);
}