editor icon indicating copy to clipboard operation
editor copied to clipboard

ci: run the test suite in CI

Open vjureta opened this issue 4 months ago • 0 comments

Why

The repo has 313 test files (~60k lines) and they're good tests — schema migrations, wall mitering, CSG cutouts, placement collision, NaN/Infinity sanitization. But almost none of them run on a pull request.

  • ci.yml runs only bun run check and bun run check-types.
  • mcp-ci.yml runs packages/mcp plus two apps/editor/lib files, and only on path matches.
  • turbo.json has no test task at all.
  • packages/viewer, packages/editor, packages/ifc-converter and apps/editor contain 95 test files between them and had no test script, so there was no way to run them even locally.

Net effect: roughly 2,200 of 2,491 tests were not acting as a gate on any change.

What this does

  • Adds a test task to turbo.json (dependsOn: ["^build"], no outputs) and a root test script, then one Test step to ci.yml.
  • Adds the missing test scripts to the four packages above.
  • Fixes a dependency-graph bug: packages/viewer declared @pascal-app/core only as a peerDependency. Turbo doesn't traverse peer deps, so ^build resolved to nothing and viewer's tests couldn't resolve core's dist/. editor, nodes and mcp all declare it in devDependencies and peerDependencies; this makes viewer consistent with them. (One line in bun.lock.)
  • Scopes each glob to src/tests/lib. Bare bun test at a package root also collects the compiled tests under dist/, which is why viewer appeared to have 132 tests when it has 66.
  • Documents bun test in SETUP.md and CONTRIBUTING.md (neither mentioned tests).

Verification

From a clean tree — rm -rf packages/*/dist packages/*/.turbo .turbo — on Bun 1.3.14:

Tasks:    12 successful, 12 total
Time:     1m3.611s
Package Tests
@pascal-app/core 760 pass, 0 fail (72 files)
@pascal-app/nodes 876 pass, 0 fail (112 files)
@pascal-app/editor 481 pass, 0 fail (66 files)
@pascal-app/mcp 297 pass, 0 fail (46 files)
@pascal-app/viewer 66 pass, 0 fail (14 files)
editor (app) 8 pass, 0 fail (2 files)
@pascal-app/ifc-converter 3 pass, 0 fail (1 file)

2,491 passing, 0 failing. Warm re-run is FULL TURBO (289ms), so the added CI step costs ~1 min cold and nothing when cached. bun run check (1,527 files) and bun run check-types (9/9) still pass.

Notes

  • No test files or product code were changed — this is wiring only.
  • mcp-ci.yml is left alone. It's now partly redundant with the root task, but it also builds packages/mcp and lints a specific file set, so I didn't want to fold it in without your call. Happy to do that in a follow-up.
  • Worth considering bun test --coverage or --bail later; deliberately kept out of scope.

[!NOTE] Low Risk Infrastructure and documentation only; no product or test logic changes. CI runtime increases on cold runs.

Overview Wires the existing Bun test suites into CI and Turborepo so PRs are gated on the full monorepo run, not just lint and typecheck.

Adds a root test script (turbo run test), a test task in turbo.json with dependsOn: ["^build"], and a Test step in ci.yml (bun run test). Packages that had tests but no entry point get scoped test scripts (apps/editor, @pascal-app/editor, @pascal-app/viewer, @pascal-app/ifc-converter).

packages/viewer now lists @pascal-app/core in devDependencies (still a peer) so Turbo’s ^build can build core before viewer tests resolve dist/. Docs in CONTRIBUTING.md and SETUP.md describe running bun test from the repo root and including tests in the PR checklist.

Reviewed by Cursor Bugbot for commit 99ff9f21e37e5122a5ff15d5c01b5aed94c00346. Bugbot is set up for automated code reviews on this repo. Configure here.

vjureta avatar Jul 27 '26 08:07 vjureta