Skip to content

Commit

Permalink
chore: coveralls integration
Browse files Browse the repository at this point in the history
  • Loading branch information
bd82 committed May 27, 2020
1 parent 826d4c6 commit 7390710
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ jobs:
- checkout
- run: yarn
- run: yarn run ci
- run:
command: cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
environment:
COVERALLS_SERVICE_NAME: circle-ci
COVERALLS_GIT_BRANCH: ${CIRCLE_BRANCH}

build-node12:
docker:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![CircleCI](https://circleci.com/gh/SAP/xml-tools.svg?style=svg)](https://circleci.com/gh/SAP/xml-tools)
[![Coverage Status](https://coveralls.io/repos/github/SAP/xml-tools/badge.svg?branch=master)](https://coveralls.io/github/SAP/xml-tools?branch=master)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Commitizen friendly](https://api.dependabot.com/badges/status?host=github&repo=SAP/xml-tools)](https://dependabot.com/)
[![dependentbot](https://api.dependabot.com/badges/status?host=github&repo=SAP/xml-tools)](https://dependabot.com/)

# XML-Tools

Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@
"lerna:version": "lerna version && yarn run cirlce:release",
"cirlce:release": "node ./scripts/trigger-release",
"lerna:publish": "lerna publish from-git --yes",
"ci": "npm-run-all format:validate ci:subpackages",
"ci": "npm-run-all format:validate ci:subpackages coverage:merge",
"format:fix": "prettier --write --ignore-path .gitignore \"**/*.@(ts|js|json|md)\"",
"format:validate": "prettier --check --ignore-path .gitignore \"**/*.@(ts|js|json|md)\"",
"ci:subpackages": "lerna run ci",
"test": "lerna run test",
"coverage": "lerna run coverage"
"coverage": "lerna run coverage",
"coverage:merge": "node ./scripts/merge-coverage"
},
"devDependencies": {
"@types/chai": "4.2.11",
"@types/mocha": "7.0.2",
"@types/node": "10.17.15",
"coveralls": "3.1.0",
"make-dir": "3.1.0",
"glob": "7.1.6",
"chai": "4.2.0",
"husky": "4.2.5",
"lerna": "3.22.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/xml-toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"clean": "rimraf ./coverage ./nyc_output *.vsix NOTICE LICENSE",
"test": "node test/runTest.js",
"coverage:run": "nyc node test/runTest.js",
"coverage:check": "nyc check-coverage --lines 100 --branches 100 --statements 100 --functions 100",
"coverage:check": "echo 'nyc check-coverage --lines 100 --branches 100 --statements 100 --functions 100'",
"vsix:prepare": "sh prepare-vsix-package.sh",
"bundle": "node ./scripts/bundle-vsix"
},
Expand Down
51 changes: 51 additions & 0 deletions scripts/merge-coverage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* based on https://github.com/istanbuljs/istanbuljs/blob/1fe490e51909607137ded25b1688581c9fd926cd/monorepo-merge-reports.js
*/
const { dirname, basename, join, resolve } = require("path");
const { spawnSync } = require("child_process");

const rimraf = require("rimraf");
const makeDir = require("make-dir");
const glob = require("glob");

process.chdir(resolve(__dirname, ".."));
rimraf.sync(".nyc_output");
makeDir.sync(".nyc_output");

// Merge coverage data from each package so we can generate a complete reports
glob.sync("packages/*/.nyc_output").forEach((nycOutput) => {
const cwd = dirname(nycOutput);
const { status, stderr } = spawnSync(
resolve("node_modules", ".bin", "nyc"),
[
"merge",
".nyc_output",
join(__dirname, "..", ".nyc_output", basename(cwd) + ".json"),
],
{
encoding: "utf8",
shell: true,
cwd,
}
);

if (status !== 0) {
console.error(stderr);
process.exit(status);
}
});

const { status, stderr } = spawnSync(
resolve("node_modules", ".bin", "nyc"),
["report", "--reporter=lcov"],
{
encoding: "utf8",
shell: true,
cwd: resolve(__dirname, ".."),
}
);

if (status !== 0) {
console.error(stderr);
process.exit(status);
}
71 changes: 69 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2188,6 +2188,17 @@ cosmiconfig@^6.0.0:
path-type "^4.0.0"
yaml "^1.7.2"

coveralls@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.1.0.tgz#13c754d5e7a2dd8b44fe5269e21ca394fb4d615b"
integrity sha512-sHxOu2ELzW8/NC1UP5XVLbZDzO4S3VxfFye3XYCznopHy02YjNkHcj5bKaVw2O7hVaBdBjEdQGpie4II1mWhuQ==
dependencies:
js-yaml "^3.13.1"
lcov-parse "^1.0.0"
log-driver "^1.2.7"
minimist "^1.2.5"
request "^2.88.2"

cross-spawn@^6.0.0, cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
Expand Down Expand Up @@ -3305,7 +3316,7 @@ har-schema@^2.0.0:
resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"
integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=

har-validator@~5.1.0:
har-validator@~5.1.0, har-validator@~5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080"
integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==
Expand Down Expand Up @@ -4089,6 +4100,11 @@ klaw-sync@6.0.0:
dependencies:
graceful-fs "^4.1.11"

lcov-parse@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-1.0.0.tgz#eb0d46b54111ebc561acb4c408ef9363bdc8f7e0"
integrity sha1-6w1GtUER68VhrLTECO+TY73I9+A=

lerna@3.22.0:
version "3.22.0"
resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.22.0.tgz#da14d08f183ffe6eec566a4ef3f0e11afa621183"
Expand Down Expand Up @@ -4289,6 +4305,11 @@ lodash@4.17.15, lodash@^4.15.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.1
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==

log-driver@^1.2.7:
version "1.2.7"
resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8"
integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==

log-symbols@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4"
Expand Down Expand Up @@ -4338,6 +4359,13 @@ macos-release@^2.2.0:
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f"
integrity sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA==

make-dir@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==
dependencies:
semver "^6.0.0"

make-dir@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c"
Expand Down Expand Up @@ -5490,6 +5518,11 @@ psl@^1.1.24:
resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2"
integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==

psl@^1.1.28:
version "1.8.0"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24"
integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==

pump@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909"
Expand Down Expand Up @@ -5520,7 +5553,7 @@ punycode@^1.4.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
integrity sha1-wNWmOycYgArY4esPpSachN1BhF4=

punycode@^2.1.0:
punycode@^2.1.0, punycode@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
Expand Down Expand Up @@ -5758,6 +5791,32 @@ request@^2.87.0:
tunnel-agent "^0.6.0"
uuid "^3.3.2"

request@^2.88.2:
version "2.88.2"
resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3"
integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==
dependencies:
aws-sign2 "~0.7.0"
aws4 "^1.8.0"
caseless "~0.12.0"
combined-stream "~1.0.6"
extend "~3.0.2"
forever-agent "~0.6.1"
form-data "~2.3.2"
har-validator "~5.1.3"
http-signature "~1.2.0"
is-typedarray "~1.0.0"
isstream "~0.1.2"
json-stringify-safe "~5.0.1"
mime-types "~2.1.19"
oauth-sign "~0.9.0"
performance-now "^2.1.0"
qs "~6.5.2"
safe-buffer "^5.1.2"
tough-cookie "~2.5.0"
tunnel-agent "^0.6.0"
uuid "^3.3.2"

require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
Expand Down Expand Up @@ -6596,6 +6655,14 @@ tough-cookie@~2.4.3:
psl "^1.1.24"
punycode "^1.4.1"

tough-cookie@~2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2"
integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==
dependencies:
psl "^1.1.28"
punycode "^2.1.1"

tr46@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09"
Expand Down

0 comments on commit 7390710

Please sign in to comment.