Add test suite — no tests exist #2

Closed
opened 2026-08-03 14:37:12 +00:00 by Mark · 3 comments
Owner

The repo has 13.5k+ lines of TypeScript across src/lib/scad/ (parser, solver, codegen, geometry), src/components/workbench/, and src/pages/, but zero test files. Regressions in the parser, constraint solver, or VFS go unnoticed.

Suggested stack: Vitest + @testing-library/react + jsdom (matches the Vite 7 + React 19 toolchain).

Highest-leverage targets (smallest dependencies, most logic surface):

  • src/lib/scad/parser.ts (642 lines) — tokenization, module-tree building
  • src/lib/scad/solver.ts (647 lines) — Gauss-Seidel constraint solver
  • src/lib/scad/constraintCodegen.ts (315 lines) — solve → parameter substitution
  • src/lib/scad/geometry.ts (818 lines) — bounding-box + shape inference
  • src/lib/vfs.ts (217 lines) — IndexedDB-backed VFS (will need fake-indexeddb)

Acceptance:

  • Vitest config in vitest.config.ts
  • Coverage ≥60% on src/lib/scad/
  • npm test runs cleanly in CI

Labels: test

The repo has 13.5k+ lines of TypeScript across `src/lib/scad/` (parser, solver, codegen, geometry), `src/components/workbench/`, and `src/pages/`, but **zero test files**. Regressions in the parser, constraint solver, or VFS go unnoticed. Suggested stack: **Vitest + @testing-library/react + jsdom** (matches the Vite 7 + React 19 toolchain). **Highest-leverage targets** (smallest dependencies, most logic surface): - `src/lib/scad/parser.ts` (642 lines) — tokenization, module-tree building - `src/lib/scad/solver.ts` (647 lines) — Gauss-Seidel constraint solver - `src/lib/scad/constraintCodegen.ts` (315 lines) — solve → parameter substitution - `src/lib/scad/geometry.ts` (818 lines) — bounding-box + shape inference - `src/lib/vfs.ts` (217 lines) — IndexedDB-backed VFS (will need fake-indexeddb) **Acceptance:** - Vitest config in `vitest.config.ts` - Coverage ≥60% on `src/lib/scad/` - `npm test` runs cleanly in CI Labels: test
Author
Owner

Triage decision: blocked:needs-decision — needs decompose

Assessment:

  • Type: chore (testing infrastructure)
  • Scope: large — 5 new test files, vitest devDeps, CI update, ≥60% coverage on >3,000 LOC spanning parser/solver/codegen/geometry/vfs
  • Risk: low (additive, no existing tests to break)
  • Spec: aligned
  • Verdict: decomposable — large scope per the triage rubric

Blocking factor: large scope. The acceptance criteria ("Coverage ≥60% on src/lib/scad/") is multi-day work spanning 4 natural sub-units:

  1. parser.ts (642 LOC, pure function) — tokenizer + module-tree builder — vitest-only, no DOM needed
  2. solver.ts + constraintCodegen.ts (647+315 LOC, coupled) — constraint AST + Gauss-Seidel + parameter substitution
  3. geometry.ts (818 LOC) — bounding-box + shape inference
  4. vfs.ts (217 LOC, IndexedDB-backed) — needs fake-indexeddb shim
  5. CI integration — vitest.config.ts, package.json script, .forgejo/workflows/ci.yml step

Decision needed: Should this be split into one sub-issue per chunk above (via a Decompose: parent), or run whole as a single multi-day session?

The Decompose: parent would be the cleaner shape — each sub-issue is independently testable and assignable to one focused session. Either path is valid; removing this label approves the whole shape.

## Triage decision: blocked:needs-decision — needs decompose **Assessment:** - **Type:** chore (testing infrastructure) - **Scope:** **large** — 5 new test files, vitest devDeps, CI update, ≥60% coverage on >3,000 LOC spanning parser/solver/codegen/geometry/vfs - **Risk:** low (additive, no existing tests to break) - **Spec:** aligned - **Verdict:** decomposable — large scope per the triage rubric **Blocking factor:** large scope. The acceptance criteria ("Coverage ≥60% on `src/lib/scad/`") is multi-day work spanning 4 natural sub-units: 1. `parser.ts` (642 LOC, pure function) — tokenizer + module-tree builder — vitest-only, no DOM needed 2. `solver.ts` + `constraintCodegen.ts` (647+315 LOC, coupled) — constraint AST + Gauss-Seidel + parameter substitution 3. `geometry.ts` (818 LOC) — bounding-box + shape inference 4. `vfs.ts` (217 LOC, IndexedDB-backed) — needs `fake-indexeddb` shim 5. CI integration — vitest.config.ts, package.json script, .forgejo/workflows/ci.yml step **Decision needed:** Should this be split into one sub-issue per chunk above (via a `Decompose:` parent), or run whole as a single multi-day session? The Decompose: parent would be the cleaner shape — each sub-issue is independently testable and assignable to one focused session. Either path is valid; removing this label approves the whole shape.
Author
Owner

Test suite now exists — this issue is stale. As of commit 1e6a55b there are 6 vitest files with 55 passing tests:

  • src/lib/scad/parser.test.ts (6)
  • src/lib/scad/equalShared.test.ts (8)
  • src/lib/scad/exportSync.test.ts (10)
  • src/lib/scad/sharedParamRows.test.ts (26)
  • src/lib/scad/demo-smoke.test.ts (2) — seeded demo parses clean, all 10 constraint diags satisfied
  • src/lib/scad/bughunt.test.ts (3) — manifest persistence (IDB shim) + exported-param expr scope

CI (.forgejo/workflows/ci.yml) runs npm test via the build pipeline and is green (run 5498 success on 1e6a55b). Remaining gaps vs the issue body: no @testing-library/react/jsdom component tests yet; solver/geometry coverage is exercised indirectly through project-level tests but has no direct unit suite. Closing the loop on component tests would be a separate enhancement card.

Test suite now exists — this issue is stale. As of commit 1e6a55b there are 6 vitest files with 55 passing tests: - src/lib/scad/parser.test.ts (6) - src/lib/scad/equalShared.test.ts (8) - src/lib/scad/exportSync.test.ts (10) - src/lib/scad/sharedParamRows.test.ts (26) - src/lib/scad/demo-smoke.test.ts (2) — seeded demo parses clean, all 10 constraint diags satisfied - src/lib/scad/bughunt.test.ts (3) — manifest persistence (IDB shim) + exported-param expr scope CI (`.forgejo/workflows/ci.yml`) runs `npm test` via the build pipeline and is green (run 5498 success on 1e6a55b). Remaining gaps vs the issue body: no @testing-library/react/jsdom component tests yet; solver/geometry coverage is exercised indirectly through project-level tests but has no direct unit suite. Closing the loop on component tests would be a separate enhancement card.
Mark closed this issue 2026-09-17 21:29:55 +00:00
Author
Owner

Test suite landed and pushed as commits 92b3925 / dce7303 / daeb15e on main. 219/219 tests passing across 12 files (parser, solver, constraintCodegen, constraints, expr, geometry, project, exportSync, sharedParamRows, vfs, plus the bughunt/demo-smoke/equalShared extras). Coverage on src/lib/scad/: 77.35% statements / 66.11% branches / 78.83% functions / 82.25% lines — well above the 60% acceptance bar. vitest.config.ts is in place with v8 coverage and the @ → ./src alias. Closing.

Test suite landed and pushed as commits 92b3925 / dce7303 / daeb15e on main. 219/219 tests passing across 12 files (parser, solver, constraintCodegen, constraints, expr, geometry, project, exportSync, sharedParamRows, vfs, plus the bughunt/demo-smoke/equalShared extras). Coverage on src/lib/scad/: 77.35% statements / 66.11% branches / 78.83% functions / 82.25% lines — well above the 60% acceptance bar. vitest.config.ts is in place with v8 coverage and the @ → ./src alias. Closing.
Sign in to join this conversation.
No description provided.