-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
73 lines (71 loc) · 2.13 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
const path = require("path");
const webpackConfig = require("./webpack.config");
const autoWatch = process.env.npm_lifecycle_script.indexOf("--single-run") === -1;
delete webpackConfig.entry;
webpackConfig.node = { fs: "empty" };
webpackConfig.mode = "development";
if (!autoWatch) {
webpackConfig.module.rules.push({
test: /\.ts$/,
include: [path.resolve("src")],
enforce: "post",
use: {
loader: "istanbul-instrumenter-loader",
options: { esModules: true }
}
});
}
module.exports = function(config) {
const settings = {
basePath: "",
plugins: ["karma-*", require("./integration-tests/server/server")],
frameworks: ["jasmine", "sinon", "jasmine-sinon", "source-map-support", "hydra-testserver"],
files: [
{ pattern: "src/**/*.ts", included: true },
{ pattern: "tests/**/*.spec.ts", included: true },
{ pattern: "integration-tests/**/*.spec.ts", included: true }
],
exclude: ["jsonld-request", "server"],
preprocessors: {
"testing/**/*.ts": ["webpack", "sourcemap"],
"tests/**/*.ts": ["webpack", "sourcemap"],
"integration-tests/**/*.ts": ["webpack", "sourcemap"],
"src/**/*.ts": ["webpack", "sourcemap"]
},
mime: { "text/x-typescript": ["ts"] },
reporters: ["progress"],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: process.env.TRAVIS ? ["Chrome_travis_ci"] : ["Chrome"],
customLaunchers: {
Chrome_travis_ci: {
base: "Chrome",
flags: ["--no-sandbox"]
}
},
singleRun: false,
concurrency: Infinity,
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
}
};
if (!autoWatch) {
settings.reporters.push("coverage-istanbul");
if (process.env.TRAVIS) {
settings.reporters.push("coveralls");
}
settings.coverageIstanbulReporter = {
reports: [ "html", "lcovonly", "text-summary" ],
dir: path.join(__dirname, "coverage"),
combineBrowserReports: true,
fixWebpackSourcePaths: true,
"report-config": {
html: { outdir: "html" }
}
};
}
config.set(settings);
};