karma.conf.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 70
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
nc 2
dl 0
loc 70
rs 10
c 0
b 0
f 0
wmc 2
mnd 1
bc 1
fnc 1
bpm 1
cpm 2
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A module.exports 0 52 2
1
// Karma configuration
2
3
const isDocker = require("is-docker")();
4
5
import path from "path";
6
7
import webpackConf from "./webpack.config.js";
8
9
delete webpackConf[0].entry;
10
//inject instrumentation
11
webpackConf[0].module.rules.push({
12
	test: /\.js$|\.jsx$/,
13
	use: {
14
		loader: "istanbul-instrumenter-loader",
15
		options: { esModules: true }
16
	},
17
	enforce: "post",
18
	exclude: /node_modules|\.spec\.js$/
19
});
20
21
module.exports = function(config) {
22
	config.set({
23
		basePath: "",
24
		frameworks: ["jasmine"],
25
		files: [
26
			{ pattern: "src/**/*karma.js", watched: false },
27
			{ pattern: "src/**/*spec.js", watched: false }
28
		],
29
		preprocessors: {
30
			"src/**/!(*.spec|*.karma).js": ["coverage"],
31
			"**/*karma.js": ["webpack", "sourcemap"],
32
			"**/*spec.js": ["webpack", "sourcemap"]
33
		},
34
		customLaunchers: {
35
			ChromeCI: {
36
				base: "Chrome",
37
				// docker needs no sandbox because perms
38
				flags: isDocker ? ["--no-sandbox"] : []
39
			}
40
		},
41
		webpack: webpackConf[0],
42
		reporters: ["spec", "coverage-istanbul"],
43
		specReporter: {
44
			suppressSkipped: true,
45
			suppressPassed: true,
46
			showSpecTiming: true
47
		},
48
		coverageIstanbulReporter: {
49
			reports: ["html", "text", "lcov"],
50
			dir: path.join(__dirname, "coverage"),
51
			// if using webpack and pre-loaders, work around webpack breaking the source path
52
			fixWebpackSourcePaths: true,
53
			// stop istanbul outputting messages like `File [${filename}] ignored, nothing could be mapped`
54
			skipFilesWithNoCoverage: true,
55
			// Most reporters accept additional config options. You can pass these through the `report-config` option
56
			"report-config": {
57
				// all options available at: https://github.com/istanbuljs/istanbul-reports/blob/590e6b0089f67b723a1fdf57bc7ccc080ff189d7/lib/html/index.js#L135-L137
58
				html: {
59
					// outputs the report in ./coverage/html
60
					subdir: "html"
61
				}
62
			}
63
		},
64
		coverageReporter: {
65
			reporters: [{ type: "text" }]
66
		},
67
		webpackMiddleware: {
68
			// webpack-dev-middleware configuration
69
			stats: "errors-only"
70
		}
71
	});
72
};
73