Skip to content

Commit dab8e30

Browse files
committed
build(repo): centralize Jest and wire extension-indent into unit run
Pin Jest and Babel TypeScript preset at the root; document library vs webapp layout and run indent package tests before the app suite. Remove duplicate Jest packages from the webapp; allow no tests without failing. Align extension-indent semver with the breaking release. Made-with: Cursor
1 parent a19bfd9 commit dab8e30

6 files changed

Lines changed: 102 additions & 72 deletions

File tree

.cursor/rules/monorepo-jest.mdc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
description: Jest and library test tooling — single source of truth at repo root
3+
alwaysApply: true
4+
---
5+
6+
# Jest / unit tests (monorepo)
7+
8+
## Source of truth
9+
10+
- **Jest, `babel-jest`, `jest-environment-jsdom`, `@types/jest`, and `@babel/preset-typescript`** (plus shared Babel bits) are **repo-root** `devDependencies` — do **not** duplicate these in workspace packages (`packages/*`) unless there is an exceptional, documented reason.
11+
- **Library packages** that need Jest use a **local** `jest.config.cjs` next to that package (`roots`, `testMatch`, `transform` / `testEnvironment` as needed). Inline is fine for one package; **extract a shared preset** only when a second package would copy the same block.
12+
- **Do not** add a per-package `babel.config.cjs` for Jest unless you need package-specific Babel behavior — prefer inline `babel-jest` options in `jest.config.cjs`.
13+
- **`@docs.plus/webapp`** keeps its own **`jest.config.js`** using **`next/jest`** — that stays app-specific.
14+
15+
## Adding tests in a new library package
16+
17+
1. Add `jest.config.cjs` in the package (self-contained or require a shared preset if you introduced one).
18+
2. Add `"test": "jest --config jest.config.cjs"` (or equivalent) in that package’s `scripts`.
19+
3. Do **not** add Jest-related packages to that package’s `devDependencies` — use root only.
20+
21+
## Bun
22+
23+
- **`bun install`** at the repo root installs hoisted dev tools; **`bun test`** is Bun’s **native** runner and is **not** a substitute for Jest where Next/Jest or this config is used — do not conflate them.

0 commit comments

Comments
 (0)