@boopkit/cap-testing 0.3.1 → 0.5.0
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/capability.json +28 -5
- package/package.json +1 -1
- package/skills/boop-testing-tdd-light/SKILL.md +28 -0
- package/skills/{test.testing.skill.md → boop-testing-testing/SKILL.md} +6 -1
- package/skills/{test.testing-express-web.skill.md → boop-testing-testing-express-web/SKILL.md} +6 -1
- package/skills/test.tdd-light.skill.md +0 -10
package/capability.json
CHANGED
|
@@ -3,11 +3,34 @@
|
|
|
3
3
|
"description": "Jest testing setup",
|
|
4
4
|
"type": "development",
|
|
5
5
|
"dependencies": [],
|
|
6
|
-
"devDependencies": [
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"devDependencies": [
|
|
7
|
+
"jest",
|
|
8
|
+
"ts-jest",
|
|
9
|
+
"@types/jest"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
"jest.config.js",
|
|
13
|
+
"tsconfig.test.json",
|
|
14
|
+
"tests/"
|
|
15
|
+
],
|
|
16
|
+
"skills": [
|
|
17
|
+
"boop-testing-tdd-light",
|
|
18
|
+
"boop-testing-testing-express-web",
|
|
19
|
+
"boop-testing-testing"
|
|
20
|
+
],
|
|
9
21
|
"scripts": {
|
|
10
|
-
"test": {
|
|
11
|
-
|
|
22
|
+
"test": {
|
|
23
|
+
"cmd": "jest --runInBand",
|
|
24
|
+
"description": "Run all tests"
|
|
25
|
+
},
|
|
26
|
+
"test:watch": {
|
|
27
|
+
"cmd": "jest --watch",
|
|
28
|
+
"description": "Run tests in watch mode"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"skill_migrations": {
|
|
32
|
+
"boop-testing-tdd-light": "test.tdd-light.skill.md",
|
|
33
|
+
"boop-testing-testing-express-web": "test.testing-express-web.skill.md",
|
|
34
|
+
"boop-testing-testing": "test.testing.skill.md"
|
|
12
35
|
}
|
|
13
36
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: boop-testing-tdd-light
|
|
3
|
+
description: "When you need to build features, implement changes, or fix bugs, follow the Light TDD Flow. This includes bug fixes found during UAT — write the failing test *before* applying the fix."
|
|
4
|
+
metadata:
|
|
5
|
+
category: test
|
|
6
|
+
---
|
|
7
|
+
# Light TDD Flow
|
|
8
|
+
|
|
9
|
+
Red → Green → Refactor. Document "before" and "after" states.
|
|
10
|
+
|
|
11
|
+
1. **Red**: Run/write tests that expose the gap (failing test for new feature, reproduced bug, baseline metric). Verify that the issue is *observed* and that tests fail for the expected reason. Document the "before" state. **For bug fixes**: write a test that reproduces the exact failure, then confirm it fails for the right reason before touching the implementation.
|
|
12
|
+
2. **Green**: Implement the minimum change. Add any additional tests.
|
|
13
|
+
3. **Verify**: Re-run all tests from steps 1-2. Type-checking alone is **not sufficient** — functional tests must pass. Check for regressions in related functionality. Verify from the user's perspective — don't just test internal state. For example, if the feature writes files the user interacts with, verify those files exist and are correct.
|
|
14
|
+
|
|
15
|
+
Test tools: `npm run test` (Jest), `npm run tester` (CLI — see `npm run tester -- help`). For UI changes, coordinate manual browser testing.
|
|
16
|
+
|
|
17
|
+
## Picking the right test shape
|
|
18
|
+
|
|
19
|
+
The cycle above says "write a test." That choice — *which kind of test* — is where TDD-Light most often goes wrong. The easy default ("I'll unit-test the function I just wrote") misses contract bugs at component boundaries. Before writing the test, decide its shape:
|
|
20
|
+
|
|
21
|
+
- **Unit test** — a pure function or class with no I/O, no callers in this repo that aren't already covered. Hand-crafted fixtures are fine.
|
|
22
|
+
- **Pairwise component test** — the code change introduces or modifies a producer/consumer interface (a function being written has callers in this repo; or the change is a new caller of an existing function). A unit test on either side is not enough — the call-site's actual argument shape must be exercised against the consumer's real behaviour. This is the single most common gap.
|
|
23
|
+
- **Integration test** — data crosses a real boundary (database, HTTP, serialization, filesystem). The boundary must be real; a mock cannot catch a boundary failure.
|
|
24
|
+
- **Route or render test** — a surface (HTML view, REST endpoint, CLI command) where the user-visible output is what matters. The full stack runs; you assert against what the user sees.
|
|
25
|
+
|
|
26
|
+
For the principles behind these choices — when each shape is required, when each is insufficient, why "tests covered the function's contract in isolation" is not enough at a producer/consumer boundary — see [general testing principles](../boop-testing-testing/SKILL.md). Read it before picking a shape on any task that touches code with callers elsewhere in the repo.
|
|
27
|
+
|
|
28
|
+
For domain-specific test mechanics in this project's Express stack — fixtures, real-service setup, route helpers, schema contracts — see [Express web tests](../boop-testing-testing-express-web/SKILL.md).
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: boop-testing-testing
|
|
3
|
+
description: "When you need to write, run, or reason about tests in this project."
|
|
4
|
+
metadata:
|
|
5
|
+
category: test
|
|
6
|
+
---
|
|
1
7
|
# Testing
|
|
2
8
|
|
|
3
|
-
When you need to write, run, or reason about tests in this project.
|
|
4
9
|
|
|
5
10
|
## Philosophy
|
|
6
11
|
|
package/skills/{test.testing-express-web.skill.md → boop-testing-testing-express-web/SKILL.md}
RENAMED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: boop-testing-testing-express-web
|
|
3
|
+
description: "When you need to write or run tests for the Express server — services, controllers, middleware, and HTTP routes."
|
|
4
|
+
metadata:
|
|
5
|
+
category: test
|
|
6
|
+
---
|
|
1
7
|
# Testing: Express App (Web & APIs)
|
|
2
8
|
|
|
3
|
-
When you need to write or run tests for the Express server — services, controllers, middleware, and HTTP routes.
|
|
4
9
|
|
|
5
10
|
Parent skill: [testing.skill.md](testing.skill.md) (philosophy, generic approach)
|
|
6
11
|
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Light TDD Flow
|
|
2
|
-
When you need to build features, implement changes, or fix bugs, follow the Light TDD Flow. This includes bug fixes found during UAT — write the failing test *before* applying the fix.
|
|
3
|
-
|
|
4
|
-
Red → Green → Refactor. Document "before" and "after" states.
|
|
5
|
-
|
|
6
|
-
1. **Red**: Run/write tests that expose the gap (failing test for new feature, reproduced bug, baseline metric). Verify that the issue is *observed* and that tests fail for the expected reason. Document the "before" state. **For bug fixes**: write a test that reproduces the exact failure, then confirm it fails for the right reason before touching the implementation.
|
|
7
|
-
2. **Green**: Implement the minimum change. Add any additional tests.
|
|
8
|
-
3. **Verify**: Re-run all tests from steps 1-2. Type-checking alone is **not sufficient** — functional tests must pass. Check for regressions in related functionality. Verify from the user's perspective — don't just test internal state. For example, if the feature writes files the user interacts with, verify those files exist and are correct.
|
|
9
|
-
|
|
10
|
-
Test tools: `npm run test` (Jest), `npm run tester` (CLI — see `npm run tester -- help`). For UI changes, coordinate manual browser testing.
|