Skip to content

Commit 3509429

Browse files
authored
fix: coverage (#42)
* fix coverage report for karma * fix coverage report for node * combine coverage report from karam and node
1 parent 3a93477 commit 3509429

File tree

8 files changed

+87
-195
lines changed

8 files changed

+87
-195
lines changed

.nycrc.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
22
"extension": [
3-
".js"
3+
".ts"
44
],
55
"reporter": [
66
"lcov",
77
"text-summary",
88
"html",
99
"json"
1010
],
11+
"exclude": [
12+
"**/*.spec.ts",
13+
"**/*.helper.ts"
14+
],
1115
"report-dir": "./coverage/node/"
1216
}

config/karma.config.js

+27-23
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,51 @@ module.exports = function (config) {
1919
coverageIstanbulReporter: {
2020
dir: "./coverage/karma/",
2121
reports: ["text-summary", "lcov", "html", "json"],
22-
fixWebpackSourcePaths: false
22+
fixWebpackSourcePaths: true
2323
},
2424
mime: {
25-
'text/x-typescript': ['ts']
25+
"text/x-typescript": ["ts"]
2626
},
2727
webpack: {
28-
externals: {
29-
"fs": "fs"
30-
},
3128
resolve: {
32-
extensions: ['.ts', '.js'],
29+
extensions: [".ts"],
3330
},
34-
devtool: "inline-source-map",
31+
devtool: "source-map",
3532
module: {
36-
// rules: [
37-
// {
38-
// test: /\.js$/,
39-
// use: [
40-
// {
41-
// loader: "istanbul-instrumenter-loader",
42-
// options: {
43-
// esModules: true
44-
// }
45-
// },
46-
// ]
47-
// }
48-
// ],
4933
loaders: [
5034
{
35+
enforce: "pre",
5136
test: /\.ts$/,
52-
loader: "ts-loader"
37+
loader: "tslint-loader",
38+
exclude: /node_modules/,
39+
options: {
40+
failOnHint: true,
41+
configFile: path.join("config", "tslint.json"),
42+
}
5343
},
44+
{
45+
test: /\.ts$/,
46+
loader: "ts-loader",
47+
options: {
48+
configFile: path.join("config", "tsconfig.webpack.json")
49+
}
50+
},
51+
{
52+
enforce: "post",
53+
exclude: [
54+
/node_modules/,
55+
/\.(spec|helper)\.ts$/
56+
],
57+
loader: "istanbul-instrumenter-loader?esModules=true",
58+
test: /\.ts$/
59+
}
5460
]
5561
}
5662
},
5763

5864
plugins: [
5965
"karma-chrome-launcher",
60-
"karma-coverage",
6166
"karma-coverage-istanbul-reporter",
62-
"istanbul-instrumenter-loader",
6367
"karma-jasmine",
6468
"karma-jasmine-matchers",
6569
"karma-webpack",

config/webpack-config-creator.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ module.exports = (options) => {
2222
},
2323
externals: options.externals,
2424
resolve: {
25-
extensions: [".ts", ".js"]
25+
extensions: [".ts"]
2626
},
2727
devtool: "source-map",
2828
module: {
2929
loaders: [
3030
{
31-
enforce: 'pre',
31+
enforce: "pre",
3232
test: /\.ts$/,
33-
loader: 'tslint-loader',
33+
loader: "tslint-loader",
3434
exclude: /node_modules/,
3535
options: {
3636
failOnHint: true,

0 commit comments

Comments
 (0)