diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdacf1586..2265a65ce 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 e8dae89a1..99cfa67eb 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 9ff9aaca9..f620ff7d7 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 862df6503..c400234ea 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 5cbd6c7a7..2f468e73a 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 10012ff43..43d1d6fa0 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 73d5899ff..e10407868 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 6d7042fd7..3905fe4e3 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 86565ea11..89c6a1996 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 dd97f6521..ee8eee6b3 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,