ci: run the test suite in CI - #548
Conversation
The repo has 313 test files (~60k lines) but nothing ran them on a pull request: `ci.yml` only did lint + type check, and `mcp-ci.yml` covered only packages/mcp plus two apps/editor files. So roughly 2,200 of the 2,491 tests never executed as a gate. - add a `test` task to turbo.json (`dependsOn: ["^build"]`) and a root `test` script, then a `Test` step to ci.yml - add the missing `test` scripts to packages/viewer, packages/editor, packages/ifc-converter and apps/editor, which all contained tests but had no way to run them - add `@pascal-app/core` to packages/viewer devDependencies. It was declared only as a peerDependency, which Turbo does not traverse, so `^build` resolved to nothing and viewer's tests could not resolve core's `dist/`. editor/nodes/mcp already declare it in both places. - scope each test glob to `src`/`tests`/`lib` so compiled tests under `dist/` are not collected a second time - document `bun test` in SETUP.md and CONTRIBUTING.md Verified from a clean tree (no dist, no turbo cache): 12/12 tasks, 2,491 tests, 0 failures; warm re-run is fully cached. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
This is the highest-leverage PR in the queue right now — 2,833 tests existed in the repo and CI ran none of them. Verified from a clean clone with your branch: I rebased onto 1. The viewer Worth recording since it could mislead a later reader: this does not break 2. 3. Fixed the underlying cause of that double-count rather than only documenting around it. One thing I'd flag as a follow-up rather than fold in here: Thanks for this one. It's exactly the kind of infrastructure work that's easy to skip and pays for itself immediately. Merging once CI reports. |
|
Merging. This gates 2,833 tests that were never running in CI — verified green from a clean clone: 12/12 turbo tasks (core 932, nodes 944, editor 575, mcp 299, viewer 87, editor-app 8, ifc-converter 3). I pushed three things on top of yours:
Two things I deliberately left out of scope: ~64 lines of pre-existing lockfile drift on |
Why
The repo has 313 test files (~60k lines) and they're good tests — schema migrations, wall mitering, CSG cutouts, placement collision,
NaN/Infinitysanitization. But almost none of them run on a pull request.ci.ymlruns onlybun run checkandbun run check-types.mcp-ci.ymlrunspackages/mcpplus twoapps/editor/libfiles, and only on path matches.turbo.jsonhas notesttask at all.packages/viewer,packages/editor,packages/ifc-converterandapps/editorcontain 95 test files between them and had notestscript, 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
testtask toturbo.json(dependsOn: ["^build"], no outputs) and a roottestscript, then oneTeststep toci.yml.testscripts to the four packages above.packages/viewerdeclared@pascal-app/coreonly as apeerDependency. Turbo doesn't traverse peer deps, so^buildresolved to nothing and viewer's tests couldn't resolve core'sdist/.editor,nodesandmcpall declare it indevDependenciesandpeerDependencies; this makesviewerconsistent with them. (One line inbun.lock.)src/tests/lib. Barebun testat a package root also collects the compiled tests underdist/, which is why viewer appeared to have 132 tests when it has 66.bun testinSETUP.mdandCONTRIBUTING.md(neither mentioned tests).Verification
From a clean tree —
rm -rf packages/*/dist packages/*/.turbo .turbo— on Bun 1.3.14:@pascal-app/core@pascal-app/nodes@pascal-app/editor@pascal-app/mcp@pascal-app/viewereditor(app)@pascal-app/ifc-converter2,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) andbun run check-types(9/9) still pass.Notes
mcp-ci.ymlis left alone. It's now partly redundant with the root task, but it also buildspackages/mcpand 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.bun test --coverageor--baillater; deliberately kept out of scope.Note
Low Risk
Infrastructure and documentation only; no runtime or test logic changes, with low blast radius beyond longer CI when the cache is cold.
Overview
Wires the monorepo test suite into CI and local workflows so thousands of existing tests actually gate PRs, without changing product or test code.
Adds a root
testscript and a Turborepotesttask (dependsOn: ["^build"]), plus a Test step inci.ymlafter typecheck. Packages that had tests but no script now expose scopedbun testcommands (src/tests/lib) so runs don’t pick up compiled copies underdist/.Fixes viewer test/build ordering:
@pascal-app/coreis added topackages/viewerdevDependencies(alongside the existing peer) so Turbo can build core before viewer tests resolvedist/. Viewertsconfigalso excludes**/*.test.*from the library build.Docs:
SETUP.md,CONTRIBUTING.md, and the PR checklist now tell contributors to usebun run test(not barebun test) and explain why.Reviewed by Cursor Bugbot for commit 4f5bc81. Bugbot is set up for automated code reviews on this repo. Configure here.