Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage #733

Merged
merged 18 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Unit test
on: [pull_request]
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Read .nvmrc
run: echo NVMRC=$(cat .nvmrc) >> $GITHUB_OUTPUT
id: nvm
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
priojeetpriyom marked this conversation as resolved.
Show resolved Hide resolved
- name: Install dependencies
run: npm ci
- name: Run unit tests and collect coverage
run: npm run test
priojeetpriyom marked this conversation as resolved.
Show resolved Hide resolved
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: coverage-final.json
name: codecov-umbrella
verbose: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[![DeepScan grade](https://deepscan.io/api/teams/6759/projects/8870/branches/113510/badge/grade.svg)](https://deepscan.io/dashboard/#view=project&tid=6759&pid=8870&bid=113510)
![GitHub issues](https://img.shields.io/github/issues-raw/liskhq/lisk-core)
![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/liskhq/lisk-core)
[![Code coverage](https://codecov.io/gh/LiskHQ/lisk-core/branch/development/graph/badge.svg?token=U0CU1XQZ52)](https://codecov.io/gh/LiskHQ/lisk-core)

Lisk is a next-generation crypto-currency and decentralized application platform, written entirely in JavaScript. The official documentation about the whole ecosystem can be found in https://lisk.com/docs.

Expand Down
17 changes: 17 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
codecov:
max_report_age: 30
notify:
wait_for_ci: false
github_checks:
annotations: false
coverage:
status:
project:
default:
# basic
target: auto
threshold: 0%
base: auto
comment:
layout: 'reach, diff, flags, files'
behavior: default
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module.exports = {
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
verbose: false,
collectCoverage: false,
coverageReporters: ['json'],
verbose: true,
collectCoverage: true,
coverageReporters: ['text', 'json'],
priojeetpriyom marked this conversation as resolved.
Show resolved Hide resolved
coverageDirectory: '.coverage',
/**
* restoreMocks [boolean]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"prepack": "oclif-dev manifest && oclif-dev readme --multi --dir=docs/commands && npm shrinkwrap && npm prune --production && npm shrinkwrap",
"prebuild": "if test -d dist; then rm -r dist; fi; rm -f tsconfig.tsbuildinfo; rm -f npm-shrinkwrap.json",
"build": "tsc",
"test": "jest",
"test": "jest --config=jest.config.js",
"test:coverage": "jest --coverage=true --coverage-reporters=text",
priojeetpriyom marked this conversation as resolved.
Show resolved Hide resolved
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:stress": "npx ts-node test/scripts/stress_test.ts",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
"rootDir": "./src",
"outDir": "./dist"
},
"include": ["./src/**/*.ts", "./src/**/*.json"]
"include": ["./src/**/*.ts", "./src/**/*.json", "jest**config.js"]
}