forked from huridocs/uwazi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.conf.js
87 lines (83 loc) · 2.5 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
82
83
84
85
86
87
/* eslint-disable */
var webpack = require('webpack');
var path = require('path');
var webpackConfig = require('./webpack.config.js');
webpackConfig.externals = {
'react/addons': true,
'jsdom': 'window',
'cheerio': 'window',
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true
}
webpackConfig.devtool = 'inline-source-map';
delete webpackConfig.entry;
delete webpackConfig.output;
karmaConfig = {
browsers: ['PhantomJS'],
singleRun: false,
frameworks: ['jasmine'],
files: [
'./node_modules/phantomjs-polyfill-find/find-polyfill.js',
'./node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js',
'tests.webpack.js'
],
plugins: [
'karma-firefox-launcher',
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-jasmine-diff-reporter',
'karma-sourcemap-loader',
'karma-webpack',
'karma-coverage'
],
browserNoActivityTimeout: 100000,
browserDisconnectTimeout: 10000,
preprocessors: {
'tests.webpack.js': [ 'webpack', 'sourcemap' ]
},
reporters: [ 'jasmine-diff', 'dots' ],
jasmineDiffReporter: {
color: {
expectedBg: '', // default 'bgRed'
expectedFg: 'green', // default 'white'
actualBg: '', // default 'bgGreen'
actualFg: 'red', // default 'white',
}
},
webpack: webpackConfig,
webpackServer: {
noInfo: true
}
}
module.exports = function (config) {
if (config.ci) {
karmaConfig.browsers = ['Firefox', 'Chrome'];
karmaConfig.singleRun = true;
//karmaConfig.reporters.push('coverage');
//karmaConfig.webpack.module.rules = [{
//enforce: 'pre',
//test: /\.js$/,
//include: [
//path.join(__dirname, 'public'),
//path.join(__dirname, 'app'),
//path.join(__dirname, 'node_modules/react-widgets/lib/fonts/'),
//path.join(__dirname, 'node_modules/font-awesome/fonts/'),
//path.join(__dirname, 'node_modules/react-widgets/lib/img/'),
//path.join(__dirname, 'node_modules/pdfjs-dist/web/images/'),
//path.join(__dirname, 'node_modules/pdfjs-dist/web/images/'),
//path.join(__dirname, 'node_modules/bootstrap/dist/fonts/')
//],
//loader: 'babel-istanbul-loader',
//exclude: /node_modules|specs/
//}];
//karmaConfig.coverageReporter = {
//type: 'lcov',
//dir: 'coverage/',
//subdir: function(browser) {
//return browser.toLowerCase().split(/[ /-]/)[0];
//}
//};
}
config.set(karmaConfig)
};