forked from CenterForOpenScience/osf.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.common.conf.js
60 lines (57 loc) · 1.98 KB
/
karma.common.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
var webpack = require('webpack');
var webpackCommon = require('./webpack.common.config.js');
// A subset of the app webpack config
var webpackTestConfig = {
devtool: 'inline-source-map',
plugins: [
// Make sure that CommonJS is always used
new webpack.DefinePlugin({
'define.amd': false
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
'window.$': 'jquery'
}),
],
resolve: Object.assign({}, webpackCommon.resolve, {
descriptionFiles: ['package.json', 'bower.json'],
}),
externals: {'jquery': 'jQuery', 'jquery-ui': 'jQuery.ui'},
module: {
rules: webpackCommon.module.rules.concat([
// Assume test files are ES6
{test: /\.test\.js$/, loader: 'babel-loader'},
])
},
node: {
fs: 'empty'
}
};
module.exports = {
frameworks: ['mocha', 'sinon'],
files: [
// Mimics loading jquery and jquery-ui with script tags
'website/static/vendor/bower_components/jquery/dist/jquery.js',
'website/static/vendor/bower_components/jquery-ui/jquery-ui.js',
'website/static/vendor/bower_components/bootstrap/dist/js/bootstrap.js',
// Only need to target one file, which will load all files in tests/ that
// match *.test.js, including addons tests
'website/static/js/tests/tests.webpack.js',
],
preprocessors: {
// add webpack as preprocessor
'website/static/js/tests/tests.webpack.js': ['webpack', 'sourcemap'],
},
webpack: webpackTestConfig,
webpackMiddleware: {noInfo: true},
webpackServer: {
noInfo: true // don't spam the console
},
// Avoid DISCONNECTED messages
// See https://github.com/karma-runner/karma/issues/598
browserDisconnectTimeout : 100000, // default 2000
browserDisconnectTolerance : 1, // default 0
browserNoActivityTimeout : 600000 //default 10000
};