Skip to content

Commit

Permalink
test: add coverage (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan authored Nov 28, 2023
1 parent 6fcb91b commit fa74f2b
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 13 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/test:coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run test coverage

on:
pull_request:
branches:
- main

jobs:
coverage:
name: Test/Coverage
runs-on: ubuntu-latest-16-core
environment: devnet-1
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'

- name: Install npm packages
run: npm ci

- name: Run Frontend test coverage
run: npm run frontend:test:coverage
env:
VITE_ERC20_MESSAGING_CONTRACT_ADDRESS: ${{ vars.ERC20_MESSAGING_CONTRACT_ADDRESS }}
VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS: ${{ vars.SUBNET_REGISTRATOR_CONTRACT_ADDRESS }}
VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS: ${{ vars.TOPOS_CORE_PROXY_CONTRACT_ADDRESS }}

- name: Run Backend test coverage
run: npm run backend:test:coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
**/dist
**/cypress/screenshots
**/cypress/videos
**/coverage
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ dApp Frontend ERC20 Messaging is the web app to transfer ERC20 tokens across any

</div>

[![codecov](https://codecov.io/gh/topos-protocol/dapp-frontend-erc20-messaging/branch/main/graph/badge.svg?token=FOH2B2GRL9&style=flat)](https://codecov.io/gh/topos-protocol/dapp-frontend-erc20-messaging)
![example workflow](https://github.com/topos-protocol/dapp-frontend-erc20-messaging/actions/workflows/test:e2e.yml/badge.svg)
<div align="center">

![docker-build](https://github.com/topos-protocol/dapp-frontend-erc20-messaging/actions/workflows/docker_build_push.yml/badge.svg)
![test](https://github.com/topos-protocol/dapp-frontend-erc20-messaging/actions/workflows/test.yml/badge.svg)
![release](https://img.shields.io/github/v/release/topos-protocol/dapp-frontend-erc20-messaging)
[![codecov](https://codecov.io/gh/topos-protocol/dapp-frontend-erc20-messaging/graph/badge.svg?token=gP7Zvl56fx)](https://codecov.io/gh/topos-protocol/dapp-frontend-erc20-messaging)
[![](https://dcbadge.vercel.app/api/server/7HZ8F8ykBT?style=flat)](https://discord.gg/7HZ8F8ykBT)

</div>

## Getting Started

Install NodeJS by following the guidelines from the [official NodeJS website](https://nodejs.dev/en/).
Expand Down
90 changes: 81 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"backend:start": "npm run start --workspace=backend",
"backend:start:prod": "npm run start:prod --workspace=backend",
"backend:test": "npm run test --workspace=backend",
"backend:test:coverage": "npm run test:cov --workspace=backend",
"backend:test:watch": "npm run test:watch --workspace=backend",
"frontend:build": "npm run build --workspace=frontend",
"frontend:start": "npm run start --workspace=frontend",
Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"start": "tsc && vite build --mode development --watch --sourcemap true",
"test:e2e": "env-cmd --silent cypress run --browser chrome --headed",
"test": "vitest",
"coverage": "vitest run --coverage"
"test:coverage": "vitest run --coverage",
"test:e2e": "env-cmd --silent cypress run --browser chrome --headed"
},
"dependencies": {
"@ant-design/icons": "^5.0.1",
Expand Down Expand Up @@ -56,6 +56,7 @@
"@typescript-eslint/parser": "^5.57.1",
"@vitejs/plugin-react-swc": "^3.0.0",
"@vitest/coverage-c8": "~0.25.8",
"@vitest/coverage-v8": "^0.34.6",
"@vitest/ui": "^0.25.8",
"cypress": "^12.13.0",
"env-cmd": "^10.1.0",
Expand Down

0 comments on commit fa74f2b

Please sign in to comment.