@boopkit/cap-testing 0.1.1 → 0.3.1
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 +72 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @boopkit/cap-testing
|
|
2
|
+
|
|
3
|
+
**Part of [Boop](https://www.npmjs.com/package/@boopkit/cli)** — a bootstrap platform for AI-first builders. `boop init` scaffolds a running Node/TypeScript web app from composable **capabilities**, each one bundling the code, dependencies, middleware wiring, and agent skills needed for a feature. You pick the capabilities; `boop add` handles the rest.
|
|
4
|
+
|
|
5
|
+
`cap-testing` sets up Jest for a TypeScript project and installs the testing skills agents need to use it well. It's mostly skills — the testing philosophy, the Light TDD loop, and Express-specific patterns — with a small scaffold so `npm test` works from the first commit.
|
|
6
|
+
|
|
7
|
+
## What You Get
|
|
8
|
+
|
|
9
|
+
Agent skills plus a minimal Jest + ts-jest scaffold. The scaffold is intentionally thin: one sample test, one config file, one test-specific tsconfig — enough that `npm test` runs green on day one and new tests follow a known layout.
|
|
10
|
+
|
|
11
|
+
### Scaffold files
|
|
12
|
+
|
|
13
|
+
Copied into your project on install:
|
|
14
|
+
|
|
15
|
+
- `jest.config.js` — ts-jest preset, Node test environment, test matcher at `tests/**/*.test.ts`
|
|
16
|
+
- `tsconfig.test.json` — extends your project tsconfig and includes `tests/`
|
|
17
|
+
- `tests/app.test.ts` — a starter test asserting the Express app boots and has body parsing wired
|
|
18
|
+
|
|
19
|
+
### Scripts added to `package.json`
|
|
20
|
+
|
|
21
|
+
| Script | Command |
|
|
22
|
+
|--------|---------|
|
|
23
|
+
| `test` | `jest --runInBand` |
|
|
24
|
+
| `test:watch` | `jest --watch` |
|
|
25
|
+
|
|
26
|
+
### Skills installed
|
|
27
|
+
|
|
28
|
+
Copied into `skills/` on install:
|
|
29
|
+
|
|
30
|
+
- `test.testing.skill.md` — the testing philosophy: functional tests over ceremony, observe failures before claiming success, mocks as a last resort, and a checklist for when the spec is silent (resolve the ambiguity first, then test).
|
|
31
|
+
- `test.tdd-light.skill.md` — the Red → Green → Verify loop, including bug fixes (write the failing test before the fix).
|
|
32
|
+
- `test.testing-express-web.skill.md` — Express-specific guidance: how to run focused Jest commands, test file layout, and patterns for services, controllers, middleware, and HTTP routes.
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
**Other capabilities:** none. The sample test expects `src/app` to export an Express app, which is provided by `cap-api` in the default `web-app` profile. If you add `cap-testing` to a project without an Express app, edit or delete `tests/app.test.ts`.
|
|
37
|
+
|
|
38
|
+
**npm devDependencies added to your project:**
|
|
39
|
+
|
|
40
|
+
- `jest` — test runner
|
|
41
|
+
- `ts-jest` — TypeScript preset for Jest
|
|
42
|
+
- `@types/jest` — TypeScript types for Jest
|
|
43
|
+
|
|
44
|
+
**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
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
Run the suite:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm test # full suite, serialized
|
|
52
|
+
npm run test:watch # watch mode
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Targeted runs (documented in `test.testing-express-web.skill.md`):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx jest tests/services/foo.test.ts --no-coverage
|
|
59
|
+
npx jest tests/services/foo.test.ts -t "handles replay"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
New tests go under `tests/`, mirroring the `src/` layout (`tests/services/foo.test.ts` for `src/services/foo.ts`). The three skill files are the canonical guide — agents should read `test.testing.skill.md` for philosophy before writing any test, `test.tdd-light.skill.md` to stay in the Red → Green → Verify loop, and `test.testing-express-web.skill.md` for the project-specific layout and commands.
|
|
63
|
+
|
|
64
|
+
## Added by
|
|
65
|
+
|
|
66
|
+
Included by default in the `web-app` profile.
|
|
67
|
+
|
|
68
|
+
Add to an existing project with:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
boop add testing
|
|
72
|
+
```
|