-
Notifications
You must be signed in to change notification settings - Fork 16
/
karma.conf.js
70 lines (66 loc) · 2.06 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
const webpackConfigs = require("./webpack.config");
const path = require("path");
const webpackConfig = webpackConfigs[0];
Object.assign(webpackConfig, {
devtool: "inline-source-map",
externals: [
"react/lib/ExecutionEnvironment",
"react/lib/ReactContext",
"react/addons",
"jsdom",
/^mxui\/|^mendix\/|^dojo\/|^dijit\//
],
});
module.exports = function(config) {
if (config.codeCoverage) {
Object.assign(webpackConfig, {
module: Object.assign(webpackConfig.module, {
rules: webpackConfig.module.rules.concat([ {
test: /\.ts$/,
enforce: "post",
loader: "istanbul-instrumenter-loader",
include: path.resolve(__dirname, "src"),
exclude: /\.(spec)\.ts$/
} ])
})
});
}
const configuration = {
basePath: "",
frameworks: [ "jasmine" ],
files: [
{ pattern: "src/**/*.ts", watched: true },
{ pattern: "tests/**/*.ts", watched: true },
"tests/test-index.js"
],
exclude: [],
preprocessors: { "tests/test-index.js": [ "webpack", "sourcemap" ] },
webpack: webpackConfig,
webpackServer: { noInfo: true },
reporters: [ "spec", config.codeCoverage ? "coverage" : "kjhtml" ],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: [ "Chrome" ],
customLaunchers: {
Chrome_travis_ci: {
base: "Chrome",
flags: [ "--no-sandbox" ]
}
},
singleRun: false,
concurrency: Infinity,
coverageReporter: {
dir: "./dist/testresults",
reporters: [
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "text" }
]
}
};
if (process.env.TRAVIS) {
configuration.browsers = [ "Chrome_travis_ci" ];
}
config.set(configuration);
};