Skip to content

Commit a1a0188

Browse files
committed
test: add MCP tool tests + coverage config + CI workflow
- Add tests/mcp-tools.test.ts: 47 tests covering all 15 MCP tools, 2 prompts, 3 resources via Client + InMemoryTransport - Add tests/graph-store.test.ts: 5 tests for full graph-store coverage - Configure vitest coverage: v8 provider, 80% thresholds, exclude cli.ts and types/ - Add .github/workflows/ci.yml: lint/typecheck/build/test on PRs, Node 18/20/22 matrix, auto-publish to npm on v* tags Coverage: 64.95% → 96.3% statements, 85.47% branch, 98.18% functions
1 parent 72727f7 commit a1a0188

6 files changed

Lines changed: 922 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
tags: ["v*"]
9+
10+
jobs:
11+
ci:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [18, 20, 22]
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: pnpm/action-setup@v4
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: pnpm
25+
26+
- run: pnpm install --frozen-lockfile
27+
28+
- name: Lint
29+
run: pnpm lint
30+
31+
- name: Typecheck
32+
run: pnpm typecheck
33+
34+
- name: Build
35+
run: pnpm build
36+
37+
- name: Test with coverage
38+
run: pnpm test -- --coverage
39+
40+
- name: Upload coverage
41+
if: matrix.node-version == 22
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: coverage-report
45+
path: coverage/
46+
47+
publish:
48+
needs: ci
49+
if: startsWith(github.ref, 'refs/tags/v')
50+
runs-on: ubuntu-latest
51+
permissions:
52+
contents: read
53+
id-token: write
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- uses: pnpm/action-setup@v4
58+
59+
- uses: actions/setup-node@v4
60+
with:
61+
node-version: 22
62+
cache: pnpm
63+
registry-url: https://registry.npmjs.org
64+
65+
- run: pnpm install --frozen-lockfile
66+
67+
- name: Build
68+
run: pnpm build
69+
70+
- name: Publish to npm
71+
run: npm publish --access public --provenance
72+
env:
73+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"devDependencies": {
5353
"@eslint/js": "^10.0.1",
5454
"@types/node": "^22.0.0",
55+
"@vitest/coverage-v8": "^3.2.4",
5556
"eslint": "^10.0.0",
5657
"tsx": "^4.21.0",
5758
"typescript-eslint": "^8.56.0",

0 commit comments

Comments
 (0)