Skip to content

Commit

Permalink
Setup code coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcollier committed Apr 15, 2020
1 parent 09cf8fe commit 74ca4e7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: |
npm install
cd test
npm install
- name: Run test with Node.js ${{ matrix.node-version }}
Expand All @@ -43,3 +42,34 @@ jobs:
- run: npm install
- name: Run eslint
run: npm run lint
coverage:
needs: [test-node]
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:3.6
ports:
- 27017:27017
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: |
cd test
npm install
- name: Generate coverage report
run: |
cd test
npm run coverage-ci
env:
CI: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./test/coverage.lcov
fail_ci_if_error: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*.lcov
*.log
*.sw[nop]
*~
.nyc_output
.project
.settings
.vscode
Expand Down
13 changes: 12 additions & 1 deletion test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"version": "0.0.1-0",
"private": true,
"scripts": {
"test": "node --preserve-symlinks test.js test"
"test": "node --preserve-symlinks test.js test",
"coverage": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary npm test",
"coverage-ci": "cross-env NODE_ENV=test nyc --reporter=text-lcov npm test > coverage.lcov",
"coverage-report": "nyc report"
},
"dependencies": {
"apisauce": "^1.1.1",
Expand All @@ -29,6 +32,14 @@
"bedrock-test": "^5.1.0",
"bedrock-validation": "^4.2.0",
"bedrock-zcap-storage": "^2.0.0",
"cross-env": "^7.0.2",
"nyc": "^15.0.1",
"sinon": "^9.0.0"
},
"nyc": {
"excludeNodeModules": false,
"include": [
"node_modules/bedrock-profile-http/**"
]
}
}

0 comments on commit 74ca4e7

Please sign in to comment.