Skip to content

Commit dce6cc0

Browse files
authored
Merge pull request #11 from GhostTypes/claude/setup-jest-tests-01EJ1yKTQdZCatuwzxFRvs1V
Set up proper test suite with Jest
2 parents c2b6960 + 74cc8a8 commit dce6cc0

18 files changed

Lines changed: 2754 additions & 205 deletions

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test Suite
2+
3+
on:
4+
# Run on pull requests
5+
pull_request:
6+
branches: [ main, master ]
7+
paths:
8+
- 'src/**'
9+
- 'package.json'
10+
- 'tsconfig.json'
11+
- '.github/workflows/test.yml'
12+
13+
# Allow manual trigger from Actions tab
14+
workflow_dispatch:
15+
16+
jobs:
17+
test:
18+
name: Run Tests
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Node.js 20.x
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20.x'
29+
30+
- name: Install dependencies
31+
run: npm install
32+
33+
- name: Run tests
34+
run: npm test

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules/
22
dist/
33
package-lock.json
44
/.idea
5-
.kiro/
5+
.kiro/coverage/
6+
coverage/

package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"prepare": "npm run build",
1313
"test": "jest",
1414
"test:watch": "jest --watch",
15-
"test:legacy": "tsx src/test.ts"
15+
"test:coverage": "jest --coverage"
1616
},
1717
"keywords": [
1818
"flashforge",
@@ -54,6 +54,19 @@
5454
"diagnostics": false
5555
}
5656
]
57+
},
58+
"collectCoverageFrom": [
59+
"src/**/*.ts",
60+
"!src/**/*.test.ts",
61+
"!src/firmware-test.ts"
62+
],
63+
"coverageThreshold": {
64+
"global": {
65+
"branches": 40,
66+
"functions": 20,
67+
"lines": 30,
68+
"statements": 30
69+
}
5770
}
5871
}
5972
}

0 commit comments

Comments
 (0)