Enable test coverage reports

This commit is contained in:
Juho Teperi 2020-03-22 15:22:11 +02:00
parent 7bbfd47f43
commit 666a80fd02
5 changed files with 28 additions and 4 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ reagent.iml
node_modules
junit
.shadow-cljs
coverage/

View File

@ -23,6 +23,9 @@ jobs:
paths:
- node_modules
key: reagent-npm-{{ checksum "package.json" }}
- store_artifacts:
path: coverage
- run: bash <(curl -s https://codecov.io/bash)
environment:
NPM_CONFIG_LOGLEVEL: warn

View File

@ -11,10 +11,12 @@
},
"devDependencies": {
"gzip-size-cli": "3.0.0",
"karma": "3.1.1",
"karma-chrome-launcher": "2.2.0",
"karma": "4.4.1",
"karma-chrome-launcher": "3.1.0",
"karma-cljs-test": "0.1.0",
"karma-junit-reporter": "1.2.0",
"karma-coverage": "https://github.com/karma-runner/karma-coverage.git#55aeead0934a39efbd9db0b575d416ab44cd8a12",
"karma-junit-reporter": "2.0.1",
"karma-sourcemap-loader": "^0.3.7",
"md5-file": "4.0.0",
"shadow-cljs": "2.8.83"
}

View File

@ -1,5 +1,5 @@
#!/bin/bash
set -ex
rm -rf target/cljsbuild/test/
lein doo chrome-headless test once
COVERAGE=1 lein doo chrome-headless test once
test -f target/cljsbuild/test/out/cljsjs/react/development/react.inc.js

View File

@ -24,5 +24,23 @@ module.exports = function(config) {
useBrowserName: false // add browser name to report and classes names
};
if (process.env.COVERAGE) {
configData.reporters = ['dots', 'junit', 'coverage'];
configData.preprocessors = {
'target/cljsbuild/test/out/reagent/**/!(*_test).js': ['sourcemap', 'coverage'],
};
configData.coverageReporter = {
reporters: [
{type: 'html'},
{type: 'lcovonly'},
],
dir: 'coverage',
subdir: '.',
includeAllSources: true,
};
}
config.set(configData);
};