@boopkit/cap-testing 0.5.4 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,7 +13,7 @@ Agent skills plus a minimal Jest + ts-jest scaffold. The scaffold is intentional
13
13
  Copied into your project on install:
14
14
 
15
15
  - `jest.config.js` — ts-jest preset, Node test environment, test matcher at `tests/**/*.test.ts`, and the worker settings the suite runs under (`maxWorkers: 4`, `workerIdleMemoryLimit: '500MB'`). Those two spread test files across a pool of worker processes Jest recycles as they grow, so a long suite's memory stays bounded instead of climbing until it dies. They live in the config rather than in the `test` script so that focused runs — `npx jest tests/foo.test.ts` — inherit them too. Because files now run concurrently, tests must namespace whatever they create; drop `maxWorkers` to 1 if a suite is not isolation-safe yet.
16
- - `tsconfig.test.json` — extends your project tsconfig and includes `tests/`
16
+ - `tsconfig.test.json` — extends your project tsconfig and includes `tests/`, widening `rootDir` to the project and naming its `@types` packages so that `src/` and `tests/` compile as one program on any TypeScript major. Its comments explain each setting.
17
17
  - `tests/app.test.ts` — a starter test asserting the Express app boots and has body parsing wired
18
18
 
19
19
  ### Scripts added to `package.json`
@@ -22,6 +22,9 @@ Copied into your project on install:
22
22
  |--------|---------|
23
23
  | `test` | `jest` |
24
24
  | `test:watch` | `jest --watch` |
25
+ | `typecheck` | `tsc -p tsconfig.test.json` |
26
+
27
+ `typecheck` is the whole-program static check the testing and planning skills tell every task to run alongside its focused tests: it sees every caller of what changed, which is the breakage a focused run is blind to.
25
28
 
26
29
  ### Skills installed
27
30
 
@@ -37,9 +40,12 @@ Copied into `skills/` on install:
37
40
 
38
41
  **npm devDependencies added to your project:**
39
42
 
40
- - `jest` — test runner
41
- - `ts-jest` — TypeScript preset for Jest
42
- - `@types/jest` — TypeScript types for Jest
43
+ - `jest@^30` — test runner
44
+ - `ts-jest@^29` — TypeScript preset for Jest
45
+ - `@types/jest@^30` — TypeScript types for Jest
46
+ - `typescript@^5` — required by `ts-jest` and by the `typecheck` script
47
+
48
+ Each is pinned to a caret major so that the toolchain a new project receives is the one boop runs its own suite against, rather than whatever shipped most recently.
43
49
 
44
50
  **Environment variables:** none required for the scaffold. Individual tests may need service credentials (the Express testing skill documents the integration-test prerequisites — local Postgres, etc.) — those are project-specific and not enforced by this capability.
45
51
 
package/capability.json CHANGED
@@ -4,9 +4,10 @@
4
4
  "type": "development",
5
5
  "dependencies": [],
6
6
  "devDependencies": [
7
- "jest",
8
- "ts-jest",
9
- "@types/jest"
7
+ "jest@^30",
8
+ "ts-jest@^29",
9
+ "@types/jest@^30",
10
+ "typescript@^5"
10
11
  ],
11
12
  "files": [
12
13
  "jest.config.js",
@@ -26,6 +27,10 @@
26
27
  "test:watch": {
27
28
  "cmd": "jest --watch",
28
29
  "description": "Run tests in watch mode"
30
+ },
31
+ "typecheck": {
32
+ "cmd": "tsc -p tsconfig.test.json",
33
+ "description": "Type-check src/ and tests/ as one program"
29
34
  }
30
35
  },
31
36
  "skill_migrations": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boopkit/cap-testing",
3
- "version": "0.5.4",
3
+ "version": "0.5.7",
4
4
  "description": "Jest testing setup and testing skills for AI agents",
5
5
  "files": [
6
6
  "scaffold/",
@@ -1,5 +1,26 @@
1
1
  {
2
+ // The config ts-jest type-checks against, and the one to point a static
3
+ // check at: `npx tsc -p tsconfig.test.json`.
2
4
  "extends": "./tsconfig.json",
5
+ "compilerOptions": {
6
+ // The base config sets "rootDir": "src" so a build emits dist/ cleanly.
7
+ // Tests live outside src/, so inheriting that root makes every one of them
8
+ // a TS6059 "not under rootDir" error before a single assertion is read.
9
+ // Widening the root to the project is what lets tests and sources share a
10
+ // program; nothing is emitted from here, so the narrower build root is
11
+ // unaffected.
12
+ "rootDir": ".",
13
+ // Type-check only. Without this a stray `tsc -p tsconfig.test.json` would
14
+ // emit compiled tests into dist/ alongside the real build output.
15
+ "noEmit": true,
16
+ // Name the type packages explicitly instead of relying on TypeScript
17
+ // pulling in everything under node_modules/@types. That automatic
18
+ // inclusion is not dependable across TypeScript majors — under 6.x it
19
+ // stops finding @types/jest here, and every `describe`/`it`/`expect` in
20
+ // the suite becomes TS2593/TS2304 while the package sits installed and
21
+ // correct. Listing them costs nothing and does not change on upgrade.
22
+ "types": ["jest", "node"]
23
+ },
3
24
  "include": ["src/**/*", "tests/**/*"],
4
25
  "exclude": ["node_modules", "dist"]
5
26
  }
@@ -4,6 +4,11 @@ description: "When you need to build features, implement changes, or fix bugs, f
4
4
  metadata:
5
5
  category: test
6
6
  ---
7
+ > **Read `PROJECT.md`, beside this file, first.**
8
+ > It records how this project applies the guidance below, and where it deliberately differs.
9
+ > Where the two conflict, `PROJECT.md` wins.
10
+ > Record project-specific rules there, never in this file.
11
+
7
12
  # Light TDD Flow
8
13
 
9
14
  Red → Green → Refactor. Document "before" and "after" states.
@@ -4,6 +4,11 @@ description: "When you need to write, run, or reason about tests in this project
4
4
  metadata:
5
5
  category: test
6
6
  ---
7
+ > **Read `PROJECT.md`, beside this file, first.**
8
+ > It records how this project applies the guidance below, and where it deliberately differs.
9
+ > Where the two conflict, `PROJECT.md` wins.
10
+ > Record project-specific rules there, never in this file.
11
+
7
12
  # Testing
8
13
 
9
14
 
@@ -62,6 +67,10 @@ A skip carrying neither a ticket reference nor a `SKIP-OK:` reason is a conventi
62
67
 
63
68
  **The rule.** A change runs the focused tests for what it touched, plus the project's whole-program static check. The full suite runs once per branch, on the work that completes it. The `boop-project-mgmt-beads-planning` skill carries the canonical wording to put on issues; this section is the reasoning behind it, and the two have to keep agreeing.
64
69
 
70
+ **The command is `npm run typecheck`** — `tsc -p tsconfig.test.json`, which compiles `src/` and `tests/` as one program and emits nothing. `boop add testing` scaffolds the script and the config together, so in any project with this capability the static check has a name rather than an invocation each agent has to derive.
71
+
72
+ If a project does not have it, add it before following the rule, and check the config before trusting it. A `tsconfig.test.json` that extends a build config and then includes `tests/**/*` inherits `"rootDir": "src"`, and every test file is then a TS6059 "not under rootDir" before a single assertion is read — a static check that fails on every file teaches an agent to skip it. The scaffolded config sets `"rootDir": "."`, `"noEmit": true` and an explicit `"types"` list for exactly that reason; its comments explain each one.
73
+
65
74
  **Why the whole suite is the wrong tool mid-change.** The problem is localization, first and foremost. Break a shared dependency and the suite reports it as a cascade of failures in tests that never mention the thing you changed, and you are then reading a wall of red to reconstruct a fact the type-checker would have told you outright, naming a file and a line. A static check plus a search for callers answers "does everything that uses this still hold?" both faster and more precisely than the suite does.
66
75
 
67
76
  Second, it is slower than the focused run, though see the caution below about how much weight that carries.
@@ -4,6 +4,11 @@ description: "When you need to write or run tests for the Express server — ser
4
4
  metadata:
5
5
  category: test
6
6
  ---
7
+ > **Read `PROJECT.md`, beside this file, first.**
8
+ > It records how this project applies the guidance below, and where it deliberately differs.
9
+ > Where the two conflict, `PROJECT.md` wins.
10
+ > Record project-specific rules there, never in this file.
11
+
7
12
  # Testing: Express App (Web & APIs)
8
13
 
9
14