Skip to content

Add test coverage

Add test coverage #61

Workflow file for this run

name: CI
on:
pull_request:
branches:
- '**'
types:
- opened
- synchronize
- reopened
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Run Code Climate Test Reporter before-build
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Run tests with coverage
run: npm run coverage
- name: Format coverage report for Code Climate
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
./cc-test-reporter format-coverage coverage/lcov.info \
--input-type lcov \
--output coverage/codeclimate.$$$.json
- name: Upload coverage to Code Climate
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
./cc-test-reporter upload-coverage \
--input coverage/codeclimate.$$$.json