Skip to content

Commit 77547d6

Browse files
committed
feat: add coverage enforcement for tests and update CI configuration
1 parent 0a2d2c6 commit 77547d6

File tree

4 files changed

+84
-2
lines changed

4 files changed

+84
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
- name: Typecheck
2727
run: bun run build
2828

29-
- name: Test
30-
run: bun run test:unit
29+
- name: Test (coverage enforcement)
30+
run: bun run test:coverage
3131

3232
- name: Guard — model-derived numerics
3333
run: bun run guard:model-derived

bun.lock

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"lint": "eslint .",
1010
"test": "bun run lint && bun run build && vitest run tests/*.test.ts tests/**/*.test.ts",
1111
"test:unit": "vitest run tests/*.test.ts tests/**/*.test.ts",
12+
"test:coverage": "vitest run --coverage",
1213
"test:watch": "vitest tests/*.test.ts tests/**/*.test.ts",
1314
"dev:harness": "bun scripts/runtime-harness-server.mjs",
1415
"test:browser": "playwright test",
@@ -33,6 +34,7 @@
3334
"devDependencies": {
3435
"@eslint/js": "latest",
3536
"@playwright/test": "latest",
37+
"@vitest/coverage-v8": "^4.1.0",
3638
"@webgpu/types": "latest",
3739
"electron": "latest",
3840
"eslint": "latest",

vitest.config.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
export default defineConfig({
4+
test: {
5+
include: ["**/*.test.ts", "**/*.spec.ts"],
6+
coverage: {
7+
provider: "v8",
8+
enabled: true,
9+
clean: true,
10+
include: ["lib/**/*.ts"],
11+
all: true,
12+
reporter: ["text", "html"],
13+
reportsDirectory: "coverage",
14+
exclude: [
15+
// Runtime configuration + platform-specific code that is not testable in this environment
16+
"lib/CreateVectorBackend.ts",
17+
"lib/WasmVectorBackend.ts",
18+
"lib/WebGLVectorBackend.ts",
19+
"lib/WebGPUVectorBackend.ts",
20+
"lib/WebNNVectorBackend.ts",
21+
// Pure type definitions (no executable JS generated)
22+
"**/*.d.ts",
23+
"**/types.ts",
24+
"**/VectorBackend.ts",
25+
"**/ModelProfile.ts",
26+
"**/QueryResult.ts",
27+
"**/WebNNTypes.*",
28+
// Test and tooling files
29+
"tests/**",
30+
"benchmarks/**",
31+
"scripts/**",
32+
"docker/**",
33+
"node_modules/**",
34+
],
35+
thresholds: {
36+
lines: 90,
37+
functions: 90,
38+
branches: 90,
39+
statements: 90,
40+
},
41+
},
42+
},
43+
});

0 commit comments

Comments
 (0)