ai-flow-dev 2.7.0 → 2.8.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/LICENSE +21 -21
- package/README.md +573 -570
- package/package.json +74 -74
- package/prompts/backend/flow-build-phase-0.md +535 -535
- package/prompts/backend/flow-build-phase-1.md +626 -626
- package/prompts/backend/flow-build-phase-10.md +340 -340
- package/prompts/backend/flow-build-phase-2.md +573 -573
- package/prompts/backend/flow-build-phase-3.md +834 -834
- package/prompts/backend/flow-build-phase-4.md +554 -554
- package/prompts/backend/flow-build-phase-5.md +703 -703
- package/prompts/backend/flow-build-phase-6.md +524 -524
- package/prompts/backend/flow-build-phase-7.md +1001 -1001
- package/prompts/backend/flow-build-phase-8.md +1407 -1407
- package/prompts/backend/flow-build-phase-9.md +477 -477
- package/prompts/backend/flow-build.md +137 -137
- package/prompts/backend/flow-check-review.md +656 -20
- package/prompts/backend/flow-check-test.md +526 -14
- package/prompts/backend/flow-check.md +725 -67
- package/prompts/backend/flow-commit.md +88 -119
- package/prompts/backend/flow-docs-sync.md +354 -354
- package/prompts/backend/flow-finish.md +919 -0
- package/prompts/backend/flow-release.md +949 -0
- package/prompts/backend/flow-work-feature.md +61 -61
- package/prompts/backend/flow-work-fix.md +46 -46
- package/prompts/backend/flow-work-refactor.md +48 -48
- package/prompts/backend/flow-work-resume.md +34 -34
- package/prompts/backend/flow-work.md +1098 -1286
- package/prompts/desktop/flow-build-phase-0.md +359 -359
- package/prompts/desktop/flow-build-phase-1.md +295 -295
- package/prompts/desktop/flow-build-phase-10.md +357 -357
- package/prompts/desktop/flow-build-phase-2.md +282 -282
- package/prompts/desktop/flow-build-phase-3.md +291 -291
- package/prompts/desktop/flow-build-phase-4.md +308 -308
- package/prompts/desktop/flow-build-phase-5.md +269 -269
- package/prompts/desktop/flow-build-phase-6.md +350 -350
- package/prompts/desktop/flow-build-phase-7.md +297 -297
- package/prompts/desktop/flow-build-phase-8.md +541 -541
- package/prompts/desktop/flow-build-phase-9.md +439 -439
- package/prompts/desktop/flow-build.md +156 -156
- package/prompts/desktop/flow-check-review.md +656 -20
- package/prompts/desktop/flow-check-test.md +526 -14
- package/prompts/desktop/flow-check.md +725 -67
- package/prompts/desktop/flow-commit.md +88 -119
- package/prompts/desktop/flow-docs-sync.md +354 -354
- package/prompts/desktop/flow-finish.md +910 -0
- package/prompts/desktop/flow-release.md +662 -0
- package/prompts/desktop/flow-work-feature.md +61 -61
- package/prompts/desktop/flow-work-fix.md +46 -46
- package/prompts/desktop/flow-work-refactor.md +48 -48
- package/prompts/desktop/flow-work-resume.md +34 -34
- package/prompts/desktop/flow-work.md +1202 -1390
- package/prompts/frontend/flow-build-phase-0.md +425 -425
- package/prompts/frontend/flow-build-phase-1.md +626 -626
- package/prompts/frontend/flow-build-phase-10.md +33 -33
- package/prompts/frontend/flow-build-phase-2.md +573 -573
- package/prompts/frontend/flow-build-phase-3.md +782 -782
- package/prompts/frontend/flow-build-phase-4.md +554 -554
- package/prompts/frontend/flow-build-phase-5.md +703 -703
- package/prompts/frontend/flow-build-phase-6.md +524 -524
- package/prompts/frontend/flow-build-phase-7.md +1001 -1001
- package/prompts/frontend/flow-build-phase-8.md +872 -872
- package/prompts/frontend/flow-build-phase-9.md +94 -94
- package/prompts/frontend/flow-build.md +137 -137
- package/prompts/frontend/flow-check-review.md +656 -20
- package/prompts/frontend/flow-check-test.md +526 -14
- package/prompts/frontend/flow-check.md +725 -67
- package/prompts/frontend/flow-commit.md +88 -119
- package/prompts/frontend/flow-docs-sync.md +550 -550
- package/prompts/frontend/flow-finish.md +910 -0
- package/prompts/frontend/flow-release.md +519 -0
- package/prompts/frontend/flow-work-api.md +1540 -0
- package/prompts/frontend/flow-work-feature.md +61 -61
- package/prompts/frontend/flow-work-fix.md +38 -38
- package/prompts/frontend/flow-work-refactor.md +48 -48
- package/prompts/frontend/flow-work-resume.md +34 -34
- package/prompts/frontend/flow-work.md +1583 -1320
- package/prompts/mobile/flow-build-phase-0.md +425 -425
- package/prompts/mobile/flow-build-phase-1.md +626 -626
- package/prompts/mobile/flow-build-phase-10.md +32 -32
- package/prompts/mobile/flow-build-phase-2.md +573 -573
- package/prompts/mobile/flow-build-phase-3.md +782 -782
- package/prompts/mobile/flow-build-phase-4.md +554 -554
- package/prompts/mobile/flow-build-phase-5.md +703 -703
- package/prompts/mobile/flow-build-phase-6.md +524 -524
- package/prompts/mobile/flow-build-phase-7.md +1001 -1001
- package/prompts/mobile/flow-build-phase-8.md +888 -888
- package/prompts/mobile/flow-build-phase-9.md +90 -90
- package/prompts/mobile/flow-build.md +135 -135
- package/prompts/mobile/flow-check-review.md +656 -20
- package/prompts/mobile/flow-check-test.md +526 -14
- package/prompts/mobile/flow-check.md +725 -67
- package/prompts/mobile/flow-commit.md +88 -119
- package/prompts/mobile/flow-docs-sync.md +620 -620
- package/prompts/mobile/flow-finish.md +910 -0
- package/prompts/mobile/flow-release.md +751 -0
- package/prompts/mobile/flow-work-api.md +1493 -0
- package/prompts/mobile/flow-work-feature.md +61 -61
- package/prompts/mobile/flow-work-fix.md +46 -46
- package/prompts/mobile/flow-work-refactor.md +48 -48
- package/prompts/mobile/flow-work-resume.md +34 -34
- package/prompts/mobile/flow-work.md +1593 -1329
- package/prompts/shared/mermaid-guidelines.md +102 -102
- package/prompts/shared/scope-levels.md +114 -114
- package/prompts/shared/smart-skip-preflight.md +214 -214
- package/prompts/shared/story-points.md +55 -55
- package/prompts/shared/task-format.md +74 -74
- package/prompts/shared/task-summary-template.md +277 -277
- package/templates/AGENT.template.md +443 -443
- package/templates/backend/.clauderules.template +112 -112
- package/templates/backend/.cursorrules.template +102 -102
- package/templates/backend/README.template.md +2 -2
- package/templates/backend/ai-instructions.template.md +2 -2
- package/templates/backend/copilot-instructions.template.md +2 -2
- package/templates/backend/docs/api.template.md +320 -320
- package/templates/backend/docs/business-flows.template.md +97 -97
- package/templates/backend/docs/code-standards.template.md +2 -2
- package/templates/backend/docs/contributing.template.md +3 -3
- package/templates/backend/docs/data-model.template.md +520 -520
- package/templates/backend/docs/testing.template.md +2 -2
- package/templates/backend/project-brief.template.md +2 -2
- package/templates/backend/specs/configuration.template.md +2 -2
- package/templates/backend/specs/security.template.md +2 -2
- package/templates/desktop/.clauderules.template +112 -112
- package/templates/desktop/.cursorrules.template +102 -102
- package/templates/desktop/README.template.md +170 -170
- package/templates/desktop/ai-instructions.template.md +366 -366
- package/templates/desktop/copilot-instructions.template.md +140 -140
- package/templates/desktop/docs/docs/api.template.md +320 -320
- package/templates/desktop/docs/docs/architecture.template.md +724 -724
- package/templates/desktop/docs/docs/business-flows.template.md +102 -102
- package/templates/desktop/docs/docs/code-standards.template.md +792 -792
- package/templates/desktop/docs/docs/contributing.template.md +149 -149
- package/templates/desktop/docs/docs/data-model.template.md +520 -520
- package/templates/desktop/docs/docs/operations.template.md +720 -720
- package/templates/desktop/docs/docs/testing.template.md +722 -722
- package/templates/desktop/project-brief.template.md +150 -150
- package/templates/desktop/specs/specs/configuration.template.md +121 -121
- package/templates/desktop/specs/specs/security.template.md +392 -392
- package/templates/frontend/README.template.md +2 -2
- package/templates/frontend/ai-instructions.template.md +2 -2
- package/templates/frontend/docs/api-integration.template.md +362 -362
- package/templates/frontend/docs/components.template.md +2 -2
- package/templates/frontend/docs/error-handling.template.md +360 -360
- package/templates/frontend/docs/operations.template.md +107 -107
- package/templates/frontend/docs/performance.template.md +124 -124
- package/templates/frontend/docs/pwa.template.md +119 -119
- package/templates/frontend/docs/state-management.template.md +2 -2
- package/templates/frontend/docs/styling.template.md +2 -2
- package/templates/frontend/docs/testing.template.md +2 -2
- package/templates/frontend/project-brief.template.md +2 -2
- package/templates/frontend/specs/accessibility.template.md +95 -95
- package/templates/frontend/specs/configuration.template.md +2 -2
- package/templates/frontend/specs/security.template.md +175 -175
- package/templates/fullstack/README.template.md +252 -252
- package/templates/fullstack/ai-instructions.template.md +444 -444
- package/templates/fullstack/project-brief.template.md +157 -157
- package/templates/fullstack/specs/configuration.template.md +340 -340
- package/templates/mobile/README.template.md +167 -167
- package/templates/mobile/ai-instructions.template.md +196 -196
- package/templates/mobile/docs/app-store.template.md +135 -135
- package/templates/mobile/docs/architecture.template.md +63 -63
- package/templates/mobile/docs/native-features.template.md +94 -94
- package/templates/mobile/docs/navigation.template.md +59 -59
- package/templates/mobile/docs/offline-strategy.template.md +65 -65
- package/templates/mobile/docs/permissions.template.md +56 -56
- package/templates/mobile/docs/state-management.template.md +85 -85
- package/templates/mobile/docs/testing.template.md +109 -109
- package/templates/mobile/project-brief.template.md +69 -69
- package/templates/mobile/specs/build-configuration.template.md +91 -91
- package/templates/mobile/specs/deployment.template.md +92 -92
- package/templates/work.template.md +47 -47
|
@@ -1,14 +1,526 @@
|
|
|
1
|
-
---
|
|
2
|
-
description:
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# AI Flow - Testing
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Technical Reference - Testing Methodology for flow-check
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# AI Flow - Testing Methodology
|
|
6
|
+
|
|
7
|
+
This document provides detailed technical reference for test execution and analysis within the `/flow-check` workflow.
|
|
8
|
+
|
|
9
|
+
> **📝 Language-Agnostic Note:** This document covers testing strategies across multiple languages and frameworks (Node.js/Jest, Python/pytest, Java/JUnit, Go, Ruby/RSpec, PHP/PHPUnit, Rust/Cargo, C#/.NET). The execution commands and result parsing examples are provided for all major ecosystems. Apply the methodology that matches your technology stack.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🎯 Overview
|
|
14
|
+
|
|
15
|
+
Automated testing validates functional correctness and code coverage. This reference covers:
|
|
16
|
+
|
|
17
|
+
- Test runner detection
|
|
18
|
+
- Execution strategies
|
|
19
|
+
- Result parsing by framework
|
|
20
|
+
- Coverage analysis
|
|
21
|
+
- Error handling
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1. Test Runner Detection
|
|
26
|
+
|
|
27
|
+
### Node.js / JavaScript / TypeScript
|
|
28
|
+
|
|
29
|
+
**Check `package.json` scripts:**
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"scripts": {
|
|
34
|
+
"test": "jest",
|
|
35
|
+
"test:unit": "jest --testPathPattern=unit",
|
|
36
|
+
"test:integration": "jest --testPathPattern=integration",
|
|
37
|
+
"test:coverage": "jest --coverage"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Common runners:**
|
|
43
|
+
|
|
44
|
+
- `jest` - Most popular, React ecosystem
|
|
45
|
+
- `vitest` - Fast, Vite ecosystem
|
|
46
|
+
- `mocha` + `chai` - Classic combination
|
|
47
|
+
- `ava` - Minimalist, concurrent
|
|
48
|
+
- `tap` / `tape` - TAP protocol
|
|
49
|
+
|
|
50
|
+
**Detection priority:**
|
|
51
|
+
|
|
52
|
+
1. Check `package.json` → `devDependencies` for test framework
|
|
53
|
+
2. Look for config files: `jest.config.js`, `vitest.config.ts`
|
|
54
|
+
3. Check `test` script in `package.json`
|
|
55
|
+
4. Default to `npm test`
|
|
56
|
+
|
|
57
|
+
### Python
|
|
58
|
+
|
|
59
|
+
**Common runners:**
|
|
60
|
+
|
|
61
|
+
- `pytest` - Most popular, feature-rich
|
|
62
|
+
- `unittest` - Built-in, standard library
|
|
63
|
+
- `nose2` - Extends unittest
|
|
64
|
+
|
|
65
|
+
**Detection:**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Check for pytest
|
|
69
|
+
if [ -f "pytest.ini" ] || [ -f "pyproject.toml" ]; then
|
|
70
|
+
pytest --version &> /dev/null && echo "pytest"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Check for unittest
|
|
74
|
+
grep -r "import unittest" tests/ && echo "unittest"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Commands:**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# pytest with coverage
|
|
81
|
+
pytest --cov=src --cov-report=json --json-report --json-report-file=test-results.json -v
|
|
82
|
+
|
|
83
|
+
# unittest discover
|
|
84
|
+
python -m unittest discover -s tests -p "test_*.py" -v
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Go
|
|
88
|
+
|
|
89
|
+
**Built-in test runner:**
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
go test -v -coverprofile=coverage.out -json ./...
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Detection:** Look for `*_test.go` files
|
|
96
|
+
|
|
97
|
+
### Java
|
|
98
|
+
|
|
99
|
+
**Common runners:**
|
|
100
|
+
|
|
101
|
+
- `JUnit 5` (Jupiter) - Modern standard
|
|
102
|
+
- `JUnit 4` - Legacy
|
|
103
|
+
- `TestNG` - Alternative framework
|
|
104
|
+
|
|
105
|
+
**Detection:**
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Maven
|
|
109
|
+
grep "junit" pom.xml && echo "JUnit via Maven"
|
|
110
|
+
|
|
111
|
+
# Gradle
|
|
112
|
+
grep "junit" build.gradle && echo "JUnit via Gradle"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Commands:**
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Maven
|
|
119
|
+
mvn test -Djacoco.skip=false
|
|
120
|
+
|
|
121
|
+
# Gradle
|
|
122
|
+
gradle test jacocoTestReport
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 2. Execution Strategies
|
|
128
|
+
|
|
129
|
+
### Full Suite (Default)
|
|
130
|
+
|
|
131
|
+
**When to use:** Regular checks, CI/CD, pre-merge validation
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Node.js
|
|
135
|
+
npm test -- --coverage --json --outputFile=.ai-flow/cache/test-results.json
|
|
136
|
+
|
|
137
|
+
# Python
|
|
138
|
+
pytest --cov --json-report --json-report-file=.ai-flow/cache/test-results.json
|
|
139
|
+
|
|
140
|
+
# Go
|
|
141
|
+
go test -v -coverprofile=.ai-flow/cache/coverage.out -json ./... 2>&1 | tee .ai-flow/cache/test-results.json
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Targeted Tests
|
|
145
|
+
|
|
146
|
+
**When to use:** Specific file changes, faster feedback
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Jest - only changed files
|
|
150
|
+
npm test -- --onlyChanged --coverage
|
|
151
|
+
|
|
152
|
+
# pytest - specific module
|
|
153
|
+
pytest tests/test_users.py -v
|
|
154
|
+
|
|
155
|
+
# Go - specific package
|
|
156
|
+
go test -v ./pkg/users/...
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Watch Mode (Not for /flow-check)
|
|
160
|
+
|
|
161
|
+
**Note:** Avoid watch mode in validation workflows. Use one-shot execution only.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 3. Result Parsing by Framework
|
|
166
|
+
|
|
167
|
+
### Jest JSON Output
|
|
168
|
+
|
|
169
|
+
**Command:**
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npm test -- --json --outputFile=test-results.json --coverage --coverageReporters=json-summary
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Parse structure:**
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"numTotalTests": 17,
|
|
180
|
+
"numPassedTests": 15,
|
|
181
|
+
"numFailedTests": 2,
|
|
182
|
+
"numPendingTests": 0,
|
|
183
|
+
"testResults": [
|
|
184
|
+
{
|
|
185
|
+
"name": "tests/user.test.ts",
|
|
186
|
+
"status": "failed",
|
|
187
|
+
"assertionResults": [
|
|
188
|
+
{
|
|
189
|
+
"fullName": "User create should validate email",
|
|
190
|
+
"status": "failed",
|
|
191
|
+
"failureMessages": ["Expected email validation..."]
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"coverageMap": {...}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Coverage from `coverage-summary.json`:**
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"total": {
|
|
205
|
+
"lines": { "total": 250, "covered": 196, "pct": 78.4 },
|
|
206
|
+
"statements": { "total": 268, "covered": 210, "pct": 78.35 },
|
|
207
|
+
"functions": { "total": 45, "covered": 38, "pct": 84.44 },
|
|
208
|
+
"branches": { "total": 58, "covered": 42, "pct": 72.41 }
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Extract:**
|
|
214
|
+
|
|
215
|
+
- `numPassedTests`, `numFailedTests`, `numTotalTests`
|
|
216
|
+
- Failed test details from `testResults[].assertionResults[]`
|
|
217
|
+
- Coverage: `total.lines.pct` (use as main metric)
|
|
218
|
+
|
|
219
|
+
### pytest JSON Report
|
|
220
|
+
|
|
221
|
+
**Command:**
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
pytest --json-report --json-report-file=test-results.json --cov --cov-report=json
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Parse structure:**
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"summary": {
|
|
232
|
+
"total": 23,
|
|
233
|
+
"passed": 20,
|
|
234
|
+
"failed": 3,
|
|
235
|
+
"skipped": 0
|
|
236
|
+
},
|
|
237
|
+
"tests": [
|
|
238
|
+
{
|
|
239
|
+
"nodeid": "tests/test_user.py::test_create_invalid_email",
|
|
240
|
+
"outcome": "failed",
|
|
241
|
+
"call": {
|
|
242
|
+
"longrepr": "AssertionError: Expected validation error"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Coverage from `coverage.json`:**
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"totals": {
|
|
254
|
+
"percent_covered": 82.5,
|
|
255
|
+
"num_statements": 320,
|
|
256
|
+
"covered_lines": 264
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Go Test JSON Output
|
|
262
|
+
|
|
263
|
+
**Command:**
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
go test -v -json ./... > test-results.json
|
|
267
|
+
go test -coverprofile=coverage.out ./...
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Parse structure (JSONL format):**
|
|
271
|
+
|
|
272
|
+
```json
|
|
273
|
+
{"Time":"2026-03-07T10:30:00Z","Action":"pass","Package":"github.com/user/pkg","Test":"TestUserCreate","Elapsed":0.02}
|
|
274
|
+
{"Time":"2026-03-07T10:30:01Z","Action":"fail","Package":"github.com/user/pkg","Test":"TestUserValidate","Elapsed":0.01}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Extract:**
|
|
278
|
+
|
|
279
|
+
- Count lines with `"Action":"pass"` and `"Action":"fail"`
|
|
280
|
+
- Parse coverage: `go tool cover -func=coverage.out`
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## 4. Coverage Analysis
|
|
285
|
+
|
|
286
|
+
### Coverage Thresholds
|
|
287
|
+
|
|
288
|
+
**Recommended minimums:**
|
|
289
|
+
|
|
290
|
+
- **Statements:** 80%
|
|
291
|
+
- **Branches:** 75%
|
|
292
|
+
- **Functions:** 85%
|
|
293
|
+
- **Lines:** 80%
|
|
294
|
+
|
|
295
|
+
**Priority:** Line coverage is the primary metric for `/flow-check` reports.
|
|
296
|
+
|
|
297
|
+
### Uncovered Critical Areas
|
|
298
|
+
|
|
299
|
+
**Flag missing coverage in:**
|
|
300
|
+
|
|
301
|
+
- Authentication/Authorization logic
|
|
302
|
+
- Payment processing
|
|
303
|
+
- Data validation
|
|
304
|
+
- Error handling paths
|
|
305
|
+
- Security-sensitive functions
|
|
306
|
+
|
|
307
|
+
### Coverage Report Format
|
|
308
|
+
|
|
309
|
+
```markdown
|
|
310
|
+
## Test Coverage
|
|
311
|
+
|
|
312
|
+
**Overall:** 78.5% ⚠️ (below 80% threshold)
|
|
313
|
+
|
|
314
|
+
| Metric | Coverage | Status |
|
|
315
|
+
| ---------- | -------- | ------ |
|
|
316
|
+
| Lines | 78.5% | ⚠️ |
|
|
317
|
+
| Statements | 78.4% | ⚠️ |
|
|
318
|
+
| Branches | 72.4% | ⚠️ |
|
|
319
|
+
| Functions | 84.4% | ✅ |
|
|
320
|
+
|
|
321
|
+
**Uncovered Critical Files:**
|
|
322
|
+
|
|
323
|
+
- `src/auth/validator.ts` - 45% (security-sensitive)
|
|
324
|
+
- `src/payment/processor.ts` - 62% (payment logic)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## 5. Failed Test Analysis
|
|
330
|
+
|
|
331
|
+
### Categorize Failures
|
|
332
|
+
|
|
333
|
+
1. **Assertion Failures** - Logic bugs
|
|
334
|
+
2. **Timeout Failures** - Performance issues
|
|
335
|
+
3. **Setup/Teardown Failures** - Test infrastructure problems
|
|
336
|
+
4. **Flaky Tests** - Intermittent failures (run twice to confirm)
|
|
337
|
+
|
|
338
|
+
### Extract Failure Details
|
|
339
|
+
|
|
340
|
+
**Required information:**
|
|
341
|
+
|
|
342
|
+
- Test name (full describe/it path)
|
|
343
|
+
- File location with line number
|
|
344
|
+
- Failure message
|
|
345
|
+
- Expected vs. actual values
|
|
346
|
+
- Stack trace (first 5 lines)
|
|
347
|
+
|
|
348
|
+
**Format:**
|
|
349
|
+
|
|
350
|
+
````markdown
|
|
351
|
+
### Failed Test 1: User.create should validate email
|
|
352
|
+
|
|
353
|
+
**File:** [tests/user.test.ts](tests/user.test.ts#L23)
|
|
354
|
+
**Error:** AssertionError: Expected email validation to reject invalid format
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
// Expected
|
|
358
|
+
expect(result.isValid).toBe(false);
|
|
359
|
+
|
|
360
|
+
// Received
|
|
361
|
+
result.isValid = true;
|
|
362
|
+
```
|
|
363
|
+
````
|
|
364
|
+
|
|
365
|
+
**Stack:**
|
|
366
|
+
|
|
367
|
+
```
|
|
368
|
+
at Object.<anonymous> (tests/user.test.ts:23:28)
|
|
369
|
+
at processTicksAndRejections (internal/process/task_queues.js:95:5)
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
````
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
## 6. Error Handling
|
|
376
|
+
|
|
377
|
+
### Command Not Found
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
if ! command -v npm &> /dev/null; then
|
|
381
|
+
echo "⚠️ npm not found, skipping tests"
|
|
382
|
+
# Update status.json
|
|
383
|
+
"tests": {"executed": false, "reason": "npm not available"}
|
|
384
|
+
fi
|
|
385
|
+
````
|
|
386
|
+
|
|
387
|
+
### Test Command Fails to Execute
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
# Capture exit code
|
|
391
|
+
npm test
|
|
392
|
+
EXIT_CODE=$?
|
|
393
|
+
|
|
394
|
+
if [ $EXIT_CODE -eq 127 ]; then
|
|
395
|
+
# Command not found
|
|
396
|
+
"tests": {"executed": false, "reason": "test script not configured"}
|
|
397
|
+
elif [ $EXIT_CODE -ne 0 ]; then
|
|
398
|
+
# Tests failed (expected)
|
|
399
|
+
"tests": {"executed": true, "passed": false}
|
|
400
|
+
fi
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Parse Errors
|
|
404
|
+
|
|
405
|
+
**Fallback to text parsing:**
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
# If JSON parse fails, extract from text output
|
|
409
|
+
npm test 2>&1 | tee test-output.txt
|
|
410
|
+
|
|
411
|
+
# Grep for common patterns
|
|
412
|
+
PASSED=$(grep -oP '\d+(?= passing)' test-output.txt)
|
|
413
|
+
FAILED=$(grep -oP '\d+(?= failing)' test-output.txt)
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Timeout Handling
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# Set 5-minute timeout
|
|
420
|
+
timeout 300 npm test || {
|
|
421
|
+
EXIT_CODE=$?
|
|
422
|
+
if [ $EXIT_CODE -eq 124 ]; then
|
|
423
|
+
echo "⚠️ Tests timed out after 5 minutes"
|
|
424
|
+
"tests": {"executed": true, "status": "timeout"}
|
|
425
|
+
fi
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## 7. Performance Considerations
|
|
432
|
+
|
|
433
|
+
### Test Execution Time
|
|
434
|
+
|
|
435
|
+
**Track and report:**
|
|
436
|
+
|
|
437
|
+
```json
|
|
438
|
+
"tests": {
|
|
439
|
+
"duration": "12.3s",
|
|
440
|
+
"slowTests": [
|
|
441
|
+
{"name": "Integration: Payment flow", "duration": "5.2s"},
|
|
442
|
+
{"name": "E2E: User signup", "duration": "3.8s"}
|
|
443
|
+
]
|
|
444
|
+
}
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
**Flag slow tests:** > 2 seconds per test
|
|
448
|
+
|
|
449
|
+
### Parallel Execution
|
|
450
|
+
|
|
451
|
+
**Enable when possible:**
|
|
452
|
+
|
|
453
|
+
```bash
|
|
454
|
+
# Jest
|
|
455
|
+
npm test -- --maxWorkers=4
|
|
456
|
+
|
|
457
|
+
# pytest
|
|
458
|
+
pytest -n 4 # requires pytest-xdist
|
|
459
|
+
|
|
460
|
+
# Go (automatic)
|
|
461
|
+
go test -v ./... # runs packages in parallel
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## 8. Integration with status.json
|
|
467
|
+
|
|
468
|
+
### Complete Test Section Schema
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
interface TestValidation {
|
|
472
|
+
executed: boolean;
|
|
473
|
+
timestamp: string;
|
|
474
|
+
duration: string;
|
|
475
|
+
|
|
476
|
+
// Results
|
|
477
|
+
passed: number;
|
|
478
|
+
failed: number;
|
|
479
|
+
skipped: number;
|
|
480
|
+
total: number;
|
|
481
|
+
status: 'passed' | 'failed' | 'timeout' | 'error';
|
|
482
|
+
summary: string; // "15/17 passed (88%)"
|
|
483
|
+
|
|
484
|
+
// Coverage
|
|
485
|
+
coverage: number; // Line coverage percentage
|
|
486
|
+
coverageDetails: {
|
|
487
|
+
lines: number;
|
|
488
|
+
statements: number;
|
|
489
|
+
branches: number;
|
|
490
|
+
functions: number;
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
// Failures
|
|
494
|
+
failedTests: Array<{
|
|
495
|
+
name: string;
|
|
496
|
+
file: string;
|
|
497
|
+
line?: number;
|
|
498
|
+
error: string;
|
|
499
|
+
}>;
|
|
500
|
+
|
|
501
|
+
// Performance
|
|
502
|
+
slowTests?: Array<{
|
|
503
|
+
name: string;
|
|
504
|
+
duration: string;
|
|
505
|
+
}>;
|
|
506
|
+
|
|
507
|
+
// Metadata
|
|
508
|
+
runner: string; // "jest", "pytest", "go test"
|
|
509
|
+
command: string; // Actual command executed
|
|
510
|
+
}
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## Summary
|
|
516
|
+
|
|
517
|
+
This reference provides the technical foundation for test execution in `/flow-check`. The orchestrator in `flow-check.md` uses these methodologies to:
|
|
518
|
+
|
|
519
|
+
1. Detect appropriate test runner
|
|
520
|
+
2. Execute tests with coverage
|
|
521
|
+
3. Parse results by framework
|
|
522
|
+
4. Extract failure details
|
|
523
|
+
5. Update status.json
|
|
524
|
+
6. Include in final report
|
|
525
|
+
|
|
526
|
+
For code review methodology, see `flow-check-review.md`.
|