Skip to content

Commit

Permalink
Merge pull request #20 from atlp-rwanda/ft-codeclimate-test_coverage
Browse files Browse the repository at this point in the history
Configuring Codeclimate And Adding Test coverage
  • Loading branch information
furebo authored May 24, 2024
2 parents 7455169 + 68f6c4b commit a1b62fa
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: 2.1


orbs:
node: circleci/[email protected]
coveralls: coveralls/[email protected]
Expand Down Expand Up @@ -34,4 +35,4 @@ workflows:
- build
- deploy:
requires:
- build
- build
33 changes: 33 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

version: "2"
checks:
argument_count:
enabled: true
file_lines:
enabled: true
method_count:
enabled: true
return_count:
enabled: true

exclude_paths:
- "node_modules/**"
- "coverage/**"

engines:
eslint:
enabled: true
config:
extensions:
- .js
- .jsx

ratings:
paths:
- "**.js"
- "**.jsx"

test_reporter:
id: "cc-test-reporter"
coverage_file:
- "coverage/lcov.info"
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

name: Test Coverage

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Install dependencies
run: npm install

- name: Run tests
run: npm run test

- name: Upload coverage to CodeClimate
env:
CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_REPO_TOKEN }}
run: |
npm install -g codeclimate-test-reporter
codeclimate-test-reporter < coverage/lcov.info
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@



[![Test Coverage](https://api.codeclimate.com/v1/badges/b8b4783a32fb76cb4953/test_coverage)](https://codeclimate.com/github/atlp-rwanda/e-commerce-furebo-32-bn/test_coverage)

[![Maintainability](https://api.codeclimate.com/v1/badges/b8b4783a32fb76cb4953/maintainability)](https://codeclimate.com/github/atlp-rwanda/e-commerce-furebo-32-bn/maintainability)
[![HoundCI](https://img.shields.io/badge/style-yellow?style=flat&logo=houndci&label=HoundCI)](https://houndci.com)
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/atlp-rwanda/e-commerce-furebo-32-bn/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/atlp-rwanda/e-commerce-furebo-32-bn/tree/main)
<div style="display: flex; justify-content: center;" align="center">
Expand Down
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ module.exports = {
restoreMocks: true,
clearMocks: true,
testTimeout:30000,
coverageReporters: ['html', 'text', 'lcov'],
coverageDirectory: 'coverage',
testPathIgnorePatterns: ['/node_modules/']
};

0 comments on commit a1b62fa

Please sign in to comment.