Skip to content
This repository was archived by the owner on Oct 26, 2018. It is now read-only.

Commit b5e7b77

Browse files
committed
Combine browser and node coverage reports
1 parent a78e3cc commit b5e7b77

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

karma.conf.js

+4-11
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ module.exports = function (config) {
1111
if (runCoverage) {
1212
coverageLoaders.push({
1313
test: /\.js$/,
14-
include: path.resolve('modules/'),
15-
exclude: /__tests__/,
14+
include: path.resolve('src/'),
1615
loader: 'isparta'
17-
})
16+
}),
1817

1918
coverageReporters.push('coverage');
2019
}
@@ -42,17 +41,11 @@ module.exports = function (config) {
4241
{
4342
test: /\.js$/,
4443
exclude: [
45-
path.resolve('src/'),
4644
path.resolve('node_modules/')
4745
],
4846
loader: 'babel'
4947
},
50-
{
51-
test: /\.js$/,
52-
include: path.resolve('src/'),
53-
loader: 'isparta'
54-
}
55-
]
48+
].concat(coverageLoaders)
5649
}
5750
},
5851

@@ -63,7 +56,7 @@ module.exports = function (config) {
6356
coverageReporter: {
6457
reporters: [
6558
{ type: 'text' },
66-
{ type: 'html', subdir: 'html' }
59+
{ type: 'json', subdir: 'browser-coverage', file: 'coverage.json' }
6760
]
6861
}
6962
});

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
"build": "mkdir -p lib && babel ./src/index.js --out-file ./lib/index.js",
1616
"test": "mocha --compilers js:babel-core/register --recursive",
1717
"test:browser": "karma start",
18-
"test:cov": "babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive",
18+
"test:cov": "npm run test:cov:browser && npm run test:cov:node && npm run test:cov:report",
19+
"test:cov:node": "babel-node $(npm bin)/isparta cover $(npm bin)/_mocha report --dir ./coverage/node-coverage -- --recursive",
20+
"test:cov:browser": "COVERAGE=true karma start",
21+
"test:cov:report": "$(npm bin)/istanbul report --dir ./coverage --include **/*coverage.json html text",
1922
"prepublish": "npm run build"
2023
},
2124
"tags": [

0 commit comments

Comments
 (0)