Skip to content

Commit d9c0a6b

Browse files
authored
Merge pull request #203 from hypercerts-org/feat/init_testing_ci
Set up test suites and testing CI
2 parents 3196dfc + 5797793 commit d9c0a6b

18 files changed

+1294
-1090
lines changed

.github/workflows/ci-test-unit.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Unit tests"
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
unit-test:
7+
runs-on: ubuntu-latest
8+
environment: test
9+
10+
env:
11+
PORT: 4000
12+
SUPABASE_CACHING_DB_URL: "https://test.supabase.com"
13+
SUPABASE_CACHING_ANON_API_KEY: "test"
14+
SUPABASE_DATA_DB_URL: "https://test.supabase.com"
15+
SUPABASE_DATA_SERVICE_API_KEY: "test"
16+
KEY: "test"
17+
PROOF: "test"
18+
19+
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
20+
DRPC_API_KEY: "test"
21+
INFURA_API_KEY: "test"
22+
23+
INDEXER_ENVIRONMENT: "test"
24+
25+
CACHING_DATABASE_URL: "https://test.supabase.com"
26+
DATA_DATABASE_URL: "https://test.supabase.com"
27+
28+
permissions:
29+
# Required to checkout the code
30+
contents: read
31+
# Required to put a comment into the pull-request
32+
pull-requests: write
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: "Install Node"
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: "20.x"
40+
41+
- uses: pnpm/action-setup@v4
42+
name: Install pnpm
43+
with:
44+
run_install: false
45+
- name: Install dependencies
46+
run: pnpm install
47+
48+
- name: "Run unit tests"
49+
run: pnpm test:coverage
50+
- name: "Report Coverage"
51+
# Set if: always() to also generate the report if tests are failing
52+
# Only works if you set `reportOnFailure: true` in your vite config as specified above
53+
if: always()
54+
uses: davelosert/vitest-coverage-report-action@v2

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"preintegration": "pnpm --dir ./lib/hypercerts-indexer i",
2121
"lint": "eslint",
2222
"test": "vitest",
23+
"test:coverage": "vitest --coverage.enabled true",
2324
"prepare": "husky",
2425
"commitlint": "commitlint --config commitlintrc.ts --edit"
2526
},
@@ -98,6 +99,7 @@
9899
"@types/pg": "^8.11.6",
99100
"@types/sinon": "^17.0.2",
100101
"@types/swagger-ui-express": "^4.1.6",
102+
"@vitest/coverage-v8": "^2.1.8",
101103
"chai": "^5.0.0",
102104
"chai-assertions-count": "^1.0.2",
103105
"concurrently": "^8.2.2",
@@ -119,7 +121,9 @@
119121
"typedoc": "^0.26.5",
120122
"typescript": "5.5.3",
121123
"typescript-eslint": "^7.7.0",
122-
"vitest": "^1.1.3"
124+
"vite-tsconfig-paths": "^5.1.4",
125+
"vitest": "^2.1.8",
126+
"vitest-mock-extended": "^2.0.2"
123127
},
124128
"lint-staged": {
125129
"*.{mjx,cjs,js,jsx,ts,tsx}": [

0 commit comments

Comments
 (0)