-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.conf.js
60 lines (57 loc) · 2.1 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
const webpackConfig = require('./webpack.config');
module.exports = function(config) {
const cfgObj = {
basePath: 'kive',
browsers: ['Chrome', 'ChromeHeadless'],
browserConsoleLogOptions: { level: "error" }, // chrome log level
customHeaders: [{
match: '.*',
name: 'Set-Cookie',
value: 'csrftoken=csrfdummytoken'
}],
frameworks: ['jasmine-ajax', 'jasmine-jquery', 'jasmine', 'webpack'],
files: [ 'tests.ts' ],
logLevel: config.LOG_INFO, // karma log level
mime: { 'text/x-typescript': ['ts','tsx'] }, // required for typescript
plugins: [
'@metahub/karma-jasmine-jquery', // forked repo uses jasmine up to 2.5.2
"karma-*",
],
preprocessors: { 'tests.ts': ['webpack', 'sourcemap'] },
port: 9876, // karma web server port
proxies: {}, // will be filled programmatically
reporters: ['progress', /* 'spec', */'kjhtml'],
webpack: Object.assign({},
webpackConfig,
{
entry: undefined, // remove entry points for bundling
output: {
// filename: "[name].bundle.js",
path: __dirname + "/build"
},
}
),
webpackMiddleware: { quiet: true } // webpack-dev-middleware configuration
};
// simulate the way Django structures directories for static file serving
serveDjangoPath(cfgObj, {
'container': ['templates', 'static', 'test_assets'],
'portal': ['static']
});
cfgObj.proxies['/portal/'] = '/base/portal/';
config.set(cfgObj);
};
function serveDjangoPath(cfgObj, pathDefs) {
for (let app in pathDefs) if (pathDefs.hasOwnProperty(app)) {
let dirs = pathDefs[app];
for (let dir of dirs) {
let appdir = `${dir}/${app}`;
cfgObj.files.push({
pattern: `${app}/${appdir}/**/*`,
included: false
});
cfgObj.proxies[`/${appdir}/`] =
`/base/${app}/${appdir}/`;
}
}
}