From 99ff9f21e37e5122a5ff15d5c01b5aed94c00346 Mon Sep 17 00:00:00 2001 From: vjureta Date: Mon, 27 Jul 2026 18:14:14 +1000 Subject: [PATCH] ci: run the test suite in CI 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) --- .github/workflows/ci.yml | 3 +++ CONTRIBUTING.md | 20 +++++++++++++++++++- SETUP.md | 1 + apps/editor/package.json | 3 ++- bun.lock | 1 + package.json | 1 + packages/editor/package.json | 3 ++- packages/ifc-converter/package.json | 1 + packages/viewer/package.json | 2 ++ turbo.json | 4 ++++ 10 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdacf15861..2265a65ce8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,3 +26,6 @@ jobs: - name: Type check run: bun run check-types + + - name: Test + run: bun run test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8dae89a14..99cfa67ebf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,6 +34,24 @@ bun check # Check for issues bun check:fix # Auto-fix issues ``` +### Tests + +Run the whole suite from the repo root: + +```bash +bun test # every package, via Turborepo +``` + +Run one package while you work on it: + +```bash +bun test --cwd packages/core +``` + +Use `bun test` from the **root**, not bare `bun test` inside a package that has +not been built — several packages import their workspace dependencies from +`dist/`, and the root task builds those first. + ### Project structure | Package | What it does | @@ -52,7 +70,7 @@ New node kinds and sidebar panels can ship as a plugin instead of editing the bu 1. **Fork the repo** and create a branch from `main` 2. **Make your changes** and test locally with `bun dev` -3. **Run `bun check`** to make sure linting passes +3. **Run `bun check` and `bun test`** to make sure linting and tests pass 4. **Open a PR** with a clear description of what changed and why 5. **Link related issues** if applicable (e.g., "Fixes #42") diff --git a/SETUP.md b/SETUP.md index 9ff9aaca9f..f620ff7d78 100644 --- a/SETUP.md +++ b/SETUP.md @@ -49,6 +49,7 @@ The editor works fully without any environment variables. | `bun check` | Lint and format check (Biome) | | `bun check:fix` | Auto-fix lint and format issues | | `bun check-types` | TypeScript type checking | +| `bun test` | Run every package's test suite | ## Contributing diff --git a/apps/editor/package.json b/apps/editor/package.json index 862df6503f..c400234eac 100644 --- a/apps/editor/package.json +++ b/apps/editor/package.json @@ -8,7 +8,8 @@ "build": "dotenv -e ../../.env.local -- next build", "start": "next start", "lint": "biome lint", - "check-types": "next typegen && tsgo --noEmit" + "check-types": "next typegen && tsgo --noEmit", + "test": "bun test lib" }, "dependencies": { "@iconify/react": "^6.0.2", diff --git a/bun.lock b/bun.lock index 5cbd6c7a77..2f468e73ad 100644 --- a/bun.lock +++ b/bun.lock @@ -292,6 +292,7 @@ "zustand": "^5", }, "devDependencies": { + "@pascal-app/core": "^0.9.2", "@pascal/typescript-config": "*", "@types/node": "^22", "@types/react": "^19.2.2", diff --git a/package.json b/package.json index 10012ff435..43d1d6fa08 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "check": "biome check", "check:fix": "biome check --write", "check-types": "turbo run check-types", + "test": "turbo run test", "kill": "lsof -ti:3002 | xargs kill -9 2>/dev/null || echo 'No processes found on port 3002'", "clean:cache": "rm -rf apps/*/.next apps/*/.swc apps/*/.turbo packages/*/.turbo tooling/*/.turbo .turbo node_modules/.cache", "restart": "bun kill && bun clean:cache && bun dev", diff --git a/packages/editor/package.json b/packages/editor/package.json index 73d5899ffe..e104078686 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -8,7 +8,8 @@ "./catalog": "./src/components/ui/item-catalog/catalog-items.tsx" }, "scripts": { - "check-types": "tsgo --noEmit" + "check-types": "tsgo --noEmit", + "test": "bun test src" }, "peerDependencies": { "@pascal-app/core": "^0.9.2", diff --git a/packages/ifc-converter/package.json b/packages/ifc-converter/package.json index 6d7042fd77..3905fe4e38 100644 --- a/packages/ifc-converter/package.json +++ b/packages/ifc-converter/package.json @@ -19,6 +19,7 @@ "scripts": { "build": "tsc --build", "dev": "tsgo --build --watch", + "test": "bun test tests", "prepublishOnly": "npm run build" }, "dependencies": { diff --git a/packages/viewer/package.json b/packages/viewer/package.json index 86565ea117..89c6a19960 100644 --- a/packages/viewer/package.json +++ b/packages/viewer/package.json @@ -19,6 +19,7 @@ "scripts": { "build": "tsc --build", "dev": "tsgo --build --watch", + "test": "bun test src", "prepublishOnly": "npm run build" }, "peerDependencies": { @@ -34,6 +35,7 @@ "zustand": "^5" }, "devDependencies": { + "@pascal-app/core": "^0.9.2", "@pascal/typescript-config": "*", "@types/node": "^22", "@types/react": "^19.2.2", diff --git a/turbo.json b/turbo.json index dd97f6521b..ee8eee6b32 100644 --- a/turbo.json +++ b/turbo.json @@ -25,6 +25,10 @@ "check-types": { "dependsOn": ["^build", "^check-types"] }, + "test": { + "dependsOn": ["^build"], + "outputs": [] + }, "dev": { "dependsOn": ["^build"], "cache": false,