ai-flow-dev 2.1.2 → 2.1.4

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.
Files changed (96) hide show
  1. package/README.md +28 -40
  2. package/dist/cli.js +69 -47
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +5 -5
  5. package/prompts/backend/flow-build-phase-0.md +96 -84
  6. package/prompts/backend/flow-build-phase-1.md +10 -18
  7. package/prompts/backend/flow-build-phase-10.md +199 -583
  8. package/prompts/backend/flow-build-phase-2.md +152 -86
  9. package/prompts/backend/flow-build-phase-3.md +108 -68
  10. package/prompts/backend/flow-build-phase-4.md +5 -8
  11. package/prompts/backend/flow-build-phase-5.md +39 -12
  12. package/prompts/backend/flow-build-phase-6.md +29 -8
  13. package/prompts/backend/flow-build-phase-7.md +121 -41
  14. package/prompts/backend/flow-build-phase-8.md +28 -65
  15. package/prompts/backend/flow-build-phase-9.md +267 -1298
  16. package/prompts/backend/flow-build.md +881 -957
  17. package/prompts/backend/flow-dev-commit.md +27 -50
  18. package/prompts/backend/flow-dev-feature.md +1929 -2017
  19. package/prompts/backend/flow-dev-fix.md +936 -964
  20. package/prompts/backend/flow-dev-refactor.md +672 -701
  21. package/prompts/backend/flow-dev-review.md +356 -389
  22. package/prompts/backend/flow-dev-work.md +1066 -1118
  23. package/prompts/backend/flow-docs-sync.md +31 -210
  24. package/prompts/frontend/flow-build-phase-0.md +503 -484
  25. package/prompts/frontend/flow-build-phase-1.md +445 -433
  26. package/prompts/frontend/flow-build-phase-2.md +910 -957
  27. package/prompts/frontend/flow-build-phase-3.md +692 -664
  28. package/prompts/frontend/flow-build-phase-4.md +478 -463
  29. package/prompts/frontend/flow-build-phase-5.md +488 -467
  30. package/prompts/frontend/flow-build-phase-6.md +571 -550
  31. package/prompts/frontend/flow-build-phase-7.md +560 -592
  32. package/prompts/frontend/flow-build-phase-8.md +17 -42
  33. package/prompts/frontend/flow-build.md +457 -503
  34. package/prompts/frontend/flow-docs-sync.md +24 -45
  35. package/prompts/mobile/flow-build-phase-0.md +104 -97
  36. package/prompts/mobile/flow-build-phase-1.md +137 -122
  37. package/prompts/mobile/flow-build-phase-2.md +123 -130
  38. package/prompts/mobile/flow-build-phase-3.md +144 -149
  39. package/prompts/mobile/flow-build-phase-4.md +140 -132
  40. package/prompts/mobile/flow-build-phase-5.md +70 -70
  41. package/prompts/mobile/flow-build-phase-6.md +136 -134
  42. package/prompts/mobile/flow-build-phase-7.md +24 -58
  43. package/prompts/mobile/flow-build-phase-8.md +17 -42
  44. package/prompts/mobile/flow-build.md +47 -97
  45. package/prompts/mobile/flow-docs-sync.md +23 -42
  46. package/prompts/shared/mermaid-guidelines.md +106 -0
  47. package/prompts/shared/scope-levels.md +126 -0
  48. package/prompts/shared/story-points.md +65 -0
  49. package/prompts/shared/task-format.md +86 -0
  50. package/templates/AGENT.template.md +194 -15
  51. package/templates/backend/README.template.md +2 -32
  52. package/templates/backend/ai-instructions.template.md +2 -32
  53. package/templates/backend/copilot-instructions.template.md +2 -22
  54. package/templates/backend/docs/api.template.md +89 -20
  55. package/templates/backend/docs/architecture.template.md +165 -53
  56. package/templates/backend/docs/business-flows.template.md +7 -14
  57. package/templates/backend/docs/code-standards.template.md +2 -38
  58. package/templates/backend/docs/contributing.template.md +2 -16
  59. package/templates/backend/docs/data-model.template.md +125 -21
  60. package/templates/backend/docs/operations.template.md +179 -50
  61. package/templates/backend/docs/testing.template.md +2 -42
  62. package/templates/backend/project-brief.template.md +2 -28
  63. package/templates/backend/specs/configuration.template.md +2 -14
  64. package/templates/backend/specs/security.template.md +2 -32
  65. package/templates/frontend/README.template.md +2 -18
  66. package/templates/frontend/ai-instructions.template.md +2 -20
  67. package/templates/frontend/docs/api-integration.template.md +12 -30
  68. package/templates/frontend/docs/components.template.md +2 -28
  69. package/templates/frontend/docs/error-handling.template.md +11 -27
  70. package/templates/frontend/docs/operations.template.md +8 -18
  71. package/templates/frontend/docs/performance.template.md +8 -18
  72. package/templates/frontend/docs/pwa.template.md +8 -18
  73. package/templates/frontend/docs/state-management.template.md +2 -28
  74. package/templates/frontend/docs/styling.template.md +2 -26
  75. package/templates/frontend/docs/testing.template.md +2 -28
  76. package/templates/frontend/project-brief.template.md +2 -16
  77. package/templates/frontend/specs/accessibility.template.md +8 -18
  78. package/templates/frontend/specs/configuration.template.md +2 -24
  79. package/templates/frontend/specs/security.template.md +10 -24
  80. package/templates/fullstack/README.template.md +17 -47
  81. package/templates/fullstack/ai-instructions.template.md +17 -45
  82. package/templates/fullstack/project-brief.template.md +16 -42
  83. package/templates/fullstack/specs/configuration.template.md +16 -42
  84. package/templates/mobile/README.template.md +11 -29
  85. package/templates/mobile/ai-instructions.template.md +11 -27
  86. package/templates/mobile/docs/app-store.template.md +11 -29
  87. package/templates/mobile/docs/architecture.template.md +14 -38
  88. package/templates/mobile/docs/native-features.template.md +16 -44
  89. package/templates/mobile/docs/navigation.template.md +9 -23
  90. package/templates/mobile/docs/offline-strategy.template.md +10 -26
  91. package/templates/mobile/docs/permissions.template.md +9 -23
  92. package/templates/mobile/docs/state-management.template.md +12 -32
  93. package/templates/mobile/docs/testing.template.md +14 -38
  94. package/templates/mobile/project-brief.template.md +12 -30
  95. package/templates/mobile/specs/build-configuration.template.md +10 -26
  96. package/templates/mobile/specs/deployment.template.md +9 -23
@@ -1,572 +1,593 @@
1
- # Phase 6: Testing Strategy
2
-
3
- **Duration:** 15-25 minutes
4
- **Questions:** ~12 questions
5
- **Output:** docs/testing.md, parts of ai-instructions.md
6
-
1
+ # Phase 6: Testing Strategy
2
+
3
+ **Duration:** 15-25 minutes
4
+ **Questions:** ~12 questions
5
+ **Output:** docs/testing.md, parts of ai-instructions.md
7
6
  ---
8
-
9
- ## 🎯 Objective
10
-
11
- Define your testing strategy:
12
-
13
- 1. What testing frameworks will you use?
14
- 2. What types of tests will you write?
15
- 3. What coverage targets?
16
- 4. How will tests run in CI/CD?
17
-
7
+ ## 🎯 Objective
8
+
9
+ Define your testing strategy:
10
+
11
+ 1. What testing frameworks will you use?
12
+ 2. What types of tests will you write?
13
+ 3. What coverage targets?
14
+ 4. How will tests run in CI/CD?
18
15
  ---
19
-
20
- ## 📋 Questions
21
-
22
- ### Question 6.1: Unit Testing Framework
23
-
24
- **What unit test framework will you use?**
25
-
26
- A) ⭐ **Vitest** (Recommended for most)
27
- - Features: Fast, Vite-native, compatible with Jest API
28
- - Best for: Vite projects, modern apps
29
- - Speed: Very fast (ESM native)
30
- - Bundle: N/A (dev dependency)
31
-
32
- B) 🔥 **Jest**
33
- - Features: Mature, widely used, snapshot testing
34
- - Best for: React apps, large ecosystem
35
- - Speed: Fast (with SWC/ESBuild)
36
- - Bundle: N/A (dev dependency)
37
-
38
- C) **Testing Library + Node Test Runner**
39
- - Features: Node.js built-in test runner (Node 18+)
40
- - Best for: Zero-dependency testing
41
- - Speed: Fast
42
-
43
- D) **Mocha + Chai**
44
- - Features: Flexible, BDD-style
45
- - Best for: Legacy projects
46
-
47
- **Your answer:**
48
-
16
+ ## 📋 Questions
17
+
18
+ ### Question 6.1: Unit Testing Framework
19
+
20
+ **What unit test framework will you use?**
21
+
22
+ A) ⭐ **Vitest** (Recommended for most)
23
+
24
+ - Features: Fast, Vite-native, compatible with Jest API
25
+ - Best for: Vite projects, modern apps
26
+ - Speed: Very fast (ESM native)
27
+ - Bundle: N/A (dev dependency)
28
+
29
+ B) 🔥 **Jest**
30
+
31
+ - Features: Mature, widely used, snapshot testing
32
+ - Best for: React apps, large ecosystem
33
+ - Speed: Fast (with SWC/ESBuild)
34
+ - Bundle: N/A (dev dependency)
35
+
36
+ C) **Testing Library + Node Test Runner**
37
+
38
+ - Features: Node.js built-in test runner (Node 18+)
39
+ - Best for: Zero-dependency testing
40
+ - Speed: Fast
41
+
42
+ D) **Mocha + Chai**
43
+
44
+ - Features: Flexible, BDD-style
45
+ - Best for: Legacy projects
46
+
47
+ **Your answer:**
49
48
  ---
50
-
51
- ### Question 6.2: Component Testing Library
52
-
53
- **How will you test components?**
54
-
55
- #### React
56
-
57
- A) ⭐ **React Testing Library** (Recommended)
58
- - Philosophy: Test user behavior, not implementation
59
- - Features: Accessible queries, user-centric
60
- - Best for: All React apps
61
-
62
- B) **Enzyme**
63
- - Features: Shallow rendering, instance testing
64
- - Best for: Legacy React apps
65
- - Note: Not recommended for new projects
66
-
67
- #### Vue
68
-
69
- A) ⭐ **Vue Test Utils** (Official)
70
- - Features: Vue-specific testing utilities
71
- - Best for: All Vue apps
72
-
73
- #### Angular
74
-
75
- A) ⭐ **Angular Testing Utilities** (Built-in)
76
- - Features: TestBed, ComponentFixture
77
- - Best for: All Angular apps
78
-
79
- #### Svelte
80
-
81
- A) ⭐ **Svelte Testing Library**
82
- - Features: User-centric testing
83
- - Best for: All Svelte apps
84
-
85
- #### Solid
86
-
87
- A) **Solid Testing Library**
88
- - Features: Similar to React Testing Library
89
- - Best for: All Solid apps
90
-
91
- **Your answer:**
92
-
49
+ ### Question 6.2: Component Testing Library
50
+
51
+ **How will you test components?**
52
+
53
+ #### React
54
+
55
+ A) ⭐ **React Testing Library** (Recommended)
56
+
57
+ - Philosophy: Test user behavior, not implementation
58
+ - Features: Accessible queries, user-centric
59
+ - Best for: All React apps
60
+
61
+ B) **Enzyme**
62
+
63
+ - Features: Shallow rendering, instance testing
64
+ - Best for: Legacy React apps
65
+ - Note: Not recommended for new projects
66
+
67
+ #### Vue
68
+
69
+ A) **Vue Test Utils** (Official)
70
+
71
+ - Features: Vue-specific testing utilities
72
+ - Best for: All Vue apps
73
+
74
+ #### Angular
75
+
76
+ A) **Angular Testing Utilities** (Built-in)
77
+
78
+ - Features: TestBed, ComponentFixture
79
+ - Best for: All Angular apps
80
+
81
+ #### Svelte
82
+
83
+ A) ⭐ **Svelte Testing Library**
84
+
85
+ - Features: User-centric testing
86
+ - Best for: All Svelte apps
87
+
88
+ #### Solid
89
+
90
+ A) ⭐ **Solid Testing Library**
91
+
92
+ - Features: Similar to React Testing Library
93
+ - Best for: All Solid apps
94
+
95
+ **Your answer:**
93
96
  ---
94
-
95
- ### Question 6.3: E2E Testing Framework
96
-
97
- **What E2E testing tool will you use?**
98
-
99
- A) ⭐ **Playwright** (Recommended)
100
- - Features: Cross-browser, fast, modern API, auto-waiting
101
- - Browsers: Chromium, Firefox, WebKit
102
- - Best for: Most apps, CI/CD friendly
103
- - Speed: Very fast
104
-
105
- B) 🔥 **Cypress**
106
- - Features: Great DX, time-travel debugging, visual testing
107
- - Browsers: Chrome, Firefox, Edge, Electron
108
- - Best for: Developer experience, visual regression
109
- - Speed: Fast
110
-
111
- C) **Puppeteer**
112
- - Features: Chrome/Chromium only, powerful API
113
- - Best for: Chrome-only testing, scraping
114
-
115
- D) **WebDriverIO**
116
- - Features: WebDriver protocol, cross-platform
117
- - Best for: Mobile testing, Appium integration
118
-
119
- E) **No E2E tests**
120
- - Best for: MVPs, small apps
121
-
122
- **Your answer:**
123
-
97
+ ### Question 6.3: E2E Testing Framework
98
+
99
+ **What E2E testing tool will you use?**
100
+
101
+ A) ⭐ **Playwright** (Recommended)
102
+
103
+ - Features: Cross-browser, fast, modern API, auto-waiting
104
+ - Browsers: Chromium, Firefox, WebKit
105
+ - Best for: Most apps, CI/CD friendly
106
+ - Speed: Very fast
107
+
108
+ B) 🔥 **Cypress**
109
+
110
+ - Features: Great DX, time-travel debugging, visual testing
111
+ - Browsers: Chrome, Firefox, Edge, Electron
112
+ - Best for: Developer experience, visual regression
113
+ - Speed: Fast
114
+
115
+ C) **Puppeteer**
116
+
117
+ - Features: Chrome/Chromium only, powerful API
118
+ - Best for: Chrome-only testing, scraping
119
+
120
+ D) **WebDriverIO**
121
+
122
+ - Features: WebDriver protocol, cross-platform
123
+ - Best for: Mobile testing, Appium integration
124
+
125
+ E) **No E2E tests**
126
+
127
+ - Best for: MVPs, small apps
128
+
129
+ **Your answer:**
124
130
  ---
125
-
126
- ### Question 6.4: Testing Pyramid Distribution
127
-
128
- **What test distribution will you target?**
129
-
130
- A) ⭐ **Standard Pyramid** (Recommended)
131
- - 70% Unit tests
132
- - 20% Integration tests
133
- - 10% E2E tests
134
- - Best for: Most apps, balanced approach
135
-
136
- B) **Heavy Unit**
137
- - 85% Unit tests
138
- - 10% Integration tests
139
- - 5% E2E tests
140
- - Best for: Logic-heavy apps, libraries
141
-
142
- C) **Heavy Integration**
143
- - 50% Unit tests
144
- - 40% Integration tests
145
- - 10% E2E tests
146
- - Best for: UI-heavy apps, component libraries
147
-
148
- D) **Testing Trophy** (Kent C. Dodds)
149
- - 30% Unit tests
150
- - 50% Integration tests
151
- - 20% E2E tests
152
- - Best for: User-centric apps
153
-
154
- **Your answer:**
155
-
131
+ ### Question 6.4: Testing Pyramid Distribution
132
+
133
+ **What test distribution will you target?**
134
+
135
+ A) ⭐ **Standard Pyramid** (Recommended)
136
+
137
+ - 70% Unit tests
138
+ - 20% Integration tests
139
+ - 10% E2E tests
140
+ - Best for: Most apps, balanced approach
141
+
142
+ B) **Heavy Unit**
143
+
144
+ - 85% Unit tests
145
+ - 10% Integration tests
146
+ - 5% E2E tests
147
+ - Best for: Logic-heavy apps, libraries
148
+
149
+ C) **Heavy Integration**
150
+
151
+ - 50% Unit tests
152
+ - 40% Integration tests
153
+ - 10% E2E tests
154
+ - Best for: UI-heavy apps, component libraries
155
+
156
+ D) **Testing Trophy** (Kent C. Dodds)
157
+
158
+ - 30% Unit tests
159
+ - 50% Integration tests
160
+ - 20% E2E tests
161
+ - Best for: User-centric apps
162
+
163
+ **Your answer:**
156
164
  ---
157
-
158
- #### 🎨 TESTING PYRAMID VISUALIZATION
159
-
160
- **Use this diagram format** to visualize test distribution strategy:
161
-
162
- ```mermaid
163
- graph TB
164
- subgraph "Testing Pyramid"
165
- E2E["🌐 E2E Tests (10%)<br/>Slow, Expensive<br/>Full user flows"]
166
- INT["🔗 Integration Tests (20%)<br/>Medium Speed<br/>Component interaction"]
167
- UNIT["⚡ Unit Tests (70%)<br/>Fast, Cheap<br/>Individual functions/components"]
168
- end
169
-
170
- E2E --> INT
171
- INT --> UNIT
172
-
173
- style E2E fill:#fce4ec,stroke:#c2185b,stroke-width:2px
174
- style INT fill:#fff4e6,stroke:#f57c00,stroke-width:2px
175
- style UNIT fill:#e8f5e9,stroke:#388e3c,stroke-width:3px
176
-
177
- classDef note fill:#f5f5f5,stroke:#666,stroke-dasharray: 5 5
178
-
179
- note1["Cost ↑<br/>Speed ↓<br/>Confidence "]:::note
180
- note2["Cost ↓<br/>Speed ↑<br/>Confidence varies"]:::note
181
-
182
- E2E -.-> note1
183
- UNIT -.-> note2
184
- ```
185
-
186
- **Alternative: Testing Trophy (Kent C. Dodds)**
187
-
188
- For apps prioritizing integration tests over unit tests:
189
-
190
- ```mermaid
191
- graph TB
192
- subgraph "Testing Trophy"
193
- E2E["🌐 E2E Tests (20%)<br/>Critical user paths"]
194
- INT["🔗 Integration Tests (50%)<br/>⭐ Focus here<br/>Component + API interaction"]
195
- UNIT[" Unit Tests (30%)<br/>Complex logic only"]
196
- STATIC["📝 Static Analysis (Base)<br/>TypeScript + ESLint"]
197
- end
198
-
199
- E2E --> INT
200
- INT --> UNIT
201
- UNIT --> STATIC
202
-
203
- style E2E fill:#fce4ec,stroke:#c2185b,stroke-width:2px
204
- style INT fill:#fff4e6,stroke:#f57c00,stroke-width:4px
205
- style UNIT fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
206
- style STATIC fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
207
- ```
208
-
209
- **When to Use Each Visualization:**
210
-
211
- - **Testing Pyramid**: Best for traditional apps, backend-heavy logic, libraries
212
- - **Testing Trophy**: Best for React apps, user-centric products, component-driven UIs
213
-
214
- **Diagram Guidelines:**
215
- - Color code by test type (E2E=pink, Integration=orange, Unit=green)
216
- - Show percentages clearly
217
- - Include speed/cost trade-offs
218
- - Update percentages based on selected strategy (A, B, C, or D)
219
-
165
+ #### 🎨 TESTING PYRAMID VISUALIZATION
166
+
167
+ **Use this diagram format** to visualize test distribution strategy:
168
+
169
+ ```mermaid
170
+ graph TB
171
+ subgraph "Testing Pyramid"
172
+ E2E["🌐 E2E Tests (10%)<br/>Slow, Expensive<br/>Full user flows"]
173
+ INT["🔗 Integration Tests (20%)<br/>Medium Speed<br/>Component interaction"]
174
+ UNIT[" Unit Tests (70%)<br/>Fast, Cheap<br/>Individual functions/components"]
175
+ end
176
+
177
+ E2E --> INT
178
+ INT --> UNIT
179
+
180
+ style E2E fill:#fce4ec,stroke:#c2185b,stroke-width:2px
181
+ style INT fill:#fff4e6,stroke:#f57c00,stroke-width:2px
182
+ style UNIT fill:#e8f5e9,stroke:#388e3c,stroke-width:3px
183
+
184
+ classDef note fill:#f5f5f5,stroke:#666,stroke-dasharray: 5 5
185
+
186
+ note1["Cost ↑<br/>Speed ↓<br/>Confidence ↑"]:::note
187
+ note2["Cost ↓<br/>Speed ↑<br/>Confidence varies"]:::note
188
+
189
+ E2E -.-> note1
190
+ UNIT -.-> note2
191
+ ```
192
+
193
+ **Alternative: Testing Trophy (Kent C. Dodds)**
194
+
195
+ For apps prioritizing integration tests over unit tests:
196
+
197
+ ```mermaid
198
+ graph TB
199
+ subgraph "Testing Trophy"
200
+ E2E["🌐 E2E Tests (20%)<br/>Critical user paths"]
201
+ INT["🔗 Integration Tests (50%)<br/>⭐ Focus here<br/>Component + API interaction"]
202
+ UNIT[" Unit Tests (30%)<br/>Complex logic only"]
203
+ STATIC["📝 Static Analysis (Base)<br/>TypeScript + ESLint"]
204
+ end
205
+
206
+ E2E --> INT
207
+ INT --> UNIT
208
+ UNIT --> STATIC
209
+
210
+ style E2E fill:#fce4ec,stroke:#c2185b,stroke-width:2px
211
+ style INT fill:#fff4e6,stroke:#f57c00,stroke-width:4px
212
+ style UNIT fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
213
+ style STATIC fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
214
+ ```
215
+
216
+ **When to Use Each Visualization:**
217
+
218
+ - **Testing Pyramid**: Best for traditional apps, backend-heavy logic, libraries
219
+ - **Testing Trophy**: Best for React apps, user-centric products, component-driven UIs
220
+
221
+ **Diagram Guidelines:**
222
+
223
+ - Color code by test type (E2E=pink, Integration=orange, Unit=green)
224
+ - Show percentages clearly
225
+ - Include speed/cost trade-offs
226
+ - Update percentages based on selected strategy (A, B, C, or D)
220
227
  ---
221
-
222
228
  ---
223
-
224
- ### Question 6.5: Code Coverage Targets
225
-
226
- **What coverage percentage will you target?**
227
-
228
- A) ⭐ **80% / 75% / 80% / 80%** (Recommended)
229
- - Statements: 80%
230
- - Branches: 75%
231
- - Functions: 80%
232
- - Lines: 80%
233
- - Best for: Most production apps
234
-
235
- B) **100% / 100% / 100% / 100%** (Strict)
236
- - All coverage at 100%
237
- - Best for: Critical apps (finance, healthcare)
238
- - Note: May be impractical
239
-
240
- C) **60% / 60% / 60% / 60%** (Lenient)
241
- - Best for: MVPs, startups
242
-
243
- D) **No coverage targets**
244
- - Best for: Prototypes only
245
-
246
- **Your answer:**
247
-
248
- **Enforce coverage in CI?**
249
- A) Yes - Fail CI if below threshold
250
- B) No - Report only, no enforcement
251
-
229
+ ### Question 6.5: Code Coverage Targets
230
+
231
+ **What coverage percentage will you target?**
232
+
233
+ A) ⭐ **80% / 75% / 80% / 80%** (Recommended)
234
+
235
+ - Statements: 80%
236
+ - Branches: 75%
237
+ - Functions: 80%
238
+ - Lines: 80%
239
+ - Best for: Most production apps
240
+
241
+ B) **100% / 100% / 100% / 100%** (Strict)
242
+
243
+ - All coverage at 100%
244
+ - Best for: Critical apps (finance, healthcare)
245
+ - Note: May be impractical
246
+
247
+ C) **60% / 60% / 60% / 60%** (Lenient)
248
+
249
+ - Best for: MVPs, startups
250
+
251
+ D) **No coverage targets**
252
+
253
+ - Best for: Prototypes only
254
+
255
+ **Your answer:**
256
+
257
+ **Enforce coverage in CI?**
258
+ A) Yes - Fail CI if below threshold
259
+ B) No - Report only, no enforcement
252
260
  ---
253
-
254
- ### Question 6.6: Snapshot Testing
255
-
256
- **Will you use snapshot testing?**
257
-
258
- Snapshot testing = Capture component output, detect unexpected changes
259
-
260
- A) ⭐ **Yes, for components**
261
- - Test component output snapshots
262
- - Best for: Preventing regressions
263
- - Tools: Jest/Vitest snapshots
264
-
265
- B) **Yes, for components + visual regression**
266
- - Add visual snapshot testing (screenshot comparison)
267
- - Best for: UI-critical apps
268
- - Tools: Percy, Chromatic, Playwright screenshots
269
-
270
- C) **No snapshot testing**
271
- - Best for: Avoiding brittle tests
272
-
273
- **Your answer:**
274
-
261
+ ### Question 6.6: Snapshot Testing
262
+
263
+ **Will you use snapshot testing?**
264
+
265
+ Snapshot testing = Capture component output, detect unexpected changes
266
+
267
+ A) ⭐ **Yes, for components**
268
+
269
+ - Test component output snapshots
270
+ - Best for: Preventing regressions
271
+ - Tools: Jest/Vitest snapshots
272
+
273
+ B) **Yes, for components + visual regression**
274
+
275
+ - Add visual snapshot testing (screenshot comparison)
276
+ - Best for: UI-critical apps
277
+ - Tools: Percy, Chromatic, Playwright screenshots
278
+
279
+ C) **No snapshot testing**
280
+
281
+ - Best for: Avoiding brittle tests
282
+
283
+ **Your answer:**
275
284
  ---
276
-
277
- ### Question 6.7: Test Data & Fixtures
278
-
279
- **How will you manage test data?**
280
-
281
- A) ⭐ **Factory functions** (Recommended)
282
- ```typescript
283
- const createUser = (overrides = {}) => ({
284
- id: '1',
285
- name: 'John Doe',
286
- email: 'john@example.com',
287
- ...overrides
288
- });
289
- ```
290
- - Best for: Flexible, reusable test data
291
-
292
- B) **Static fixtures**
293
- ```typescript
294
- // fixtures/users.json
295
- {
296
- "user1": { "id": "1", "name": "John Doe" }
297
- }
298
- ```
299
- - Best for: Consistent test data
300
-
301
- C) **Faker.js / @faker-js/faker**
302
- - Generate random realistic data
303
- - Best for: Large datasets, avoiding hardcoding
304
-
305
- D) **Inline data**
306
- - Define data directly in tests
307
- - Best for: Simple tests
308
-
309
- **Your answer:**
310
-
285
+ ### Question 6.7: Test Data & Fixtures
286
+
287
+ **How will you manage test data?**
288
+
289
+ A) ⭐ **Factory functions** (Recommended)
290
+
291
+ ```typescript
292
+ const createUser = (overrides = {}) => ({
293
+ id: '1',
294
+ name: 'John Doe',
295
+ email: 'john@example.com',
296
+ ...overrides,
297
+ });
298
+ ```
299
+
300
+ - Best for: Flexible, reusable test data
301
+
302
+ B) **Static fixtures**
303
+
304
+ ```typescript
305
+ // fixtures/users.json
306
+ {
307
+ "user1": { "id": "1", "name": "John Doe" }
308
+ }
309
+ ```
310
+
311
+ - Best for: Consistent test data
312
+
313
+ C) **Faker.js / @faker-js/faker**
314
+
315
+ - Generate random realistic data
316
+ - Best for: Large datasets, avoiding hardcoding
317
+
318
+ D) **Inline data**
319
+
320
+ - Define data directly in tests
321
+ - Best for: Simple tests
322
+
323
+ **Your answer:**
311
324
  ---
312
-
313
- ### Question 6.8: Mocking Strategy
314
-
315
- **How will you mock dependencies?**
316
-
317
- A) ⭐ **Mock Service Worker (MSW)** (Recommended for API mocking)
318
- - Features: Intercept network requests, works in tests and browser
319
- - Best for: API mocking, realistic tests
320
- - Example:
321
- ```typescript
322
- rest.get('/api/users', (req, res, ctx) => {
323
- return res(ctx.json({ users: [...] }));
324
- });
325
- ```
326
-
327
- B) **Vitest/Jest mocks**
328
- - Features: `vi.mock()` / `jest.mock()` for modules
329
- - Best for: Module/function mocking
330
- - Example:
331
- ```typescript
332
- vi.mock('./api', () => ({
333
- fetchUser: vi.fn(() => Promise.resolve({ id: '1' }))
334
- }));
335
- ```
336
-
337
- C) **Manual mocks**
338
- - Features: Create mock implementations manually
339
- - Best for: Full control
340
-
341
- D) **No mocking**
342
- - Test against real APIs
343
- - Best for: Integration tests only
344
-
345
- **Your answer:**
346
-
325
+ ### Question 6.8: Mocking Strategy
326
+
327
+ **How will you mock dependencies?**
328
+
329
+ A) ⭐ **Mock Service Worker (MSW)** (Recommended for API mocking)
330
+
331
+ - Features: Intercept network requests, works in tests and browser
332
+ - Best for: API mocking, realistic tests
333
+ - Example:
334
+ ```typescript
335
+ rest.get('/api/users', (req, res, ctx) => {
336
+ return res(ctx.json({ users: [...] }));
337
+ });
338
+ ```
339
+
340
+ B) **Vitest/Jest mocks**
341
+
342
+ - Features: `vi.mock()` / `jest.mock()` for modules
343
+ - Best for: Module/function mocking
344
+ - Example:
345
+ ```typescript
346
+ vi.mock('./api', () => ({
347
+ fetchUser: vi.fn(() => Promise.resolve({ id: '1' })),
348
+ }));
349
+ ```
350
+
351
+ C) **Manual mocks**
352
+
353
+ - Features: Create mock implementations manually
354
+ - Best for: Full control
355
+
356
+ D) **No mocking**
357
+
358
+ - Test against real APIs
359
+ - Best for: Integration tests only
360
+
361
+ **Your answer:**
347
362
  ---
348
-
349
- ### Question 6.9: Test Organization
350
-
351
- **How will you organize tests?**
352
-
353
- A) ⭐ **Collocated with source** (Recommended)
354
- ```
355
- components/
356
- ├── Button/
357
- │ ├── Button.tsx
358
- │ ├── Button.test.tsx
359
- │ └── Button.stories.tsx
360
- ```
361
- - Best for: Modularity, easy to find tests
362
-
363
- B) **Separate __tests__ folder**
364
- ```
365
- components/
366
- ├── Button/
367
- │ ├── Button.tsx
368
- │ └── __tests__/
369
- │ └── Button.test.tsx
370
- ```
371
- - Best for: Jest convention
372
-
373
- C) **Mirrored test folder**
374
- ```
375
- src/
376
- ├── components/Button.tsx
377
- tests/
378
- ├── components/Button.test.tsx
379
- ```
380
- - Best for: Separation of concerns
381
-
382
- **Your answer:**
383
-
384
- **E2E test location:**
385
- - `e2e/` folder at root
386
- - `tests/e2e/` folder
387
- - `__e2e__/` folders throughout
388
-
363
+ ### Question 6.9: Test Organization
364
+
365
+ **How will you organize tests?**
366
+
367
+ A) ⭐ **Collocated with source** (Recommended)
368
+
369
+ ```
370
+ components/
371
+ ├── Button/
372
+ │ ├── Button.tsx
373
+ │ ├── Button.test.tsx
374
+ │ └── Button.stories.tsx
375
+ ```
376
+
377
+ - Best for: Modularity, easy to find tests
378
+
379
+ B) **Separate **tests** folder**
380
+
381
+ ```
382
+ components/
383
+ ├── Button/
384
+ ├── Button.tsx
385
+ └── __tests__/
386
+ │ └── Button.test.tsx
387
+ ```
388
+
389
+ - Best for: Jest convention
390
+
391
+ C) **Mirrored test folder**
392
+
393
+ ```
394
+ src/
395
+ ├── components/Button.tsx
396
+ tests/
397
+ ├── components/Button.test.tsx
398
+ ```
399
+
400
+ - Best for: Separation of concerns
401
+
402
+ **Your answer:**
403
+
404
+ **E2E test location:**
405
+
406
+ - `e2e/` folder at root
407
+ - `tests/e2e/` folder
408
+ - `__e2e__/` folders throughout
389
409
  ---
390
-
391
- ### Question 6.10: CI/CD Test Execution
392
-
393
- **How will tests run in CI?**
394
-
395
- A) ⭐ **All tests on every PR** (Recommended)
396
- - Unit + Integration + E2E
397
- - Best for: Most apps, catch regressions early
398
-
399
- B) **Unit/Integration on PR, E2E on merge to main**
400
- - Faster PR feedback, comprehensive on main
401
- - Best for: Slow E2E suites
402
-
403
- C) **Unit on PR, full suite nightly**
404
- - Best for: Very large test suites
405
-
406
- D) **Manual test runs**
407
- - Not recommended
408
-
409
- **Your answer:**
410
-
411
- **Parallel test execution:**
412
- A) Yes - Run tests in parallel (faster)
413
- B) No - Sequential execution
414
-
415
- **Retry failed tests:**
416
- A) Yes - Retry flaky tests (specify retries: ___)
417
- B) No - Fail immediately
418
-
410
+ ### Question 6.10: CI/CD Test Execution
411
+
412
+ **How will tests run in CI?**
413
+
414
+ A) ⭐ **All tests on every PR** (Recommended)
415
+
416
+ - Unit + Integration + E2E
417
+ - Best for: Most apps, catch regressions early
418
+
419
+ B) **Unit/Integration on PR, E2E on merge to main**
420
+
421
+ - Faster PR feedback, comprehensive on main
422
+ - Best for: Slow E2E suites
423
+
424
+ C) **Unit on PR, full suite nightly**
425
+
426
+ - Best for: Very large test suites
427
+
428
+ D) **Manual test runs**
429
+
430
+ - Not recommended
431
+
432
+ **Your answer:**
433
+
434
+ **Parallel test execution:**
435
+ A) Yes - Run tests in parallel (faster)
436
+ B) No - Sequential execution
437
+
438
+ **Retry failed tests:**
439
+ A) Yes - Retry flaky tests (specify retries: \_\_\_)
440
+ B) No - Fail immediately
441
+ ---
442
+ ### Question 6.11: Visual Regression Testing
443
+
444
+ **Will you do visual regression testing?**
445
+
446
+ Visual regression = Screenshot comparison to detect unintended UI changes
447
+
448
+ A) ⭐ **Yes, with Percy / Chromatic**
449
+
450
+ - Features: Cloud-based, visual diffs, review UI
451
+ - Best for: Design-critical apps, component libraries
452
+
453
+ B) **Yes, with Playwright snapshots**
454
+
455
+ - Features: Local screenshot comparison
456
+ - Best for: Self-hosted, free option
457
+
458
+ C) **No visual regression**
459
+
460
+ - Best for: MVPs, non-visual apps
461
+
462
+ **Your answer:**
463
+
464
+ **If yes, what to test:**
465
+
466
+ - [ ] Critical user flows (checkout, signup)
467
+ - [ ] All components (Storybook)
468
+ - [ ] Responsive breakpoints
469
+ - [ ] Dark/light themes
470
+ ---
471
+ ### Question 6.12: Accessibility Testing
472
+
473
+ **How will you test accessibility?**
474
+
475
+ A) ⭐ **jest-axe / vitest-axe**
476
+
477
+ ```typescript
478
+ it('has no a11y violations', async () => {
479
+ const { container } = render(<Button>Click me</Button>);
480
+ const results = await axe(container);
481
+ expect(results).toHaveNoViolations();
482
+ });
483
+ ```
484
+
485
+ - Best for: Automated a11y checks in unit tests
486
+
487
+ B) **@axe-core/playwright / @axe-core/cypress**
488
+
489
+ - E2E accessibility testing
490
+ - Best for: Full-page a11y scans
491
+
492
+ C) **Manual testing**
493
+
494
+ - Screen reader testing, keyboard navigation
495
+ - Best for: Comprehensive a11y
496
+
497
+ D) **No automated a11y testing**
498
+
499
+ - Best for: MVPs only (not recommended)
500
+
501
+ E) **Combined (automated + manual)**
502
+
503
+ - Best for: WCAG compliance
504
+
505
+ **Your answer:**
419
506
  ---
420
-
421
- ### Question 6.11: Visual Regression Testing
422
-
423
- **Will you do visual regression testing?**
424
-
425
- Visual regression = Screenshot comparison to detect unintended UI changes
426
-
427
- A) ⭐ **Yes, with Percy / Chromatic**
428
- - Features: Cloud-based, visual diffs, review UI
429
- - Best for: Design-critical apps, component libraries
430
-
431
- B) **Yes, with Playwright snapshots**
432
- - Features: Local screenshot comparison
433
- - Best for: Self-hosted, free option
434
-
435
- C) **No visual regression**
436
- - Best for: MVPs, non-visual apps
437
-
438
- **Your answer:**
439
-
440
- **If yes, what to test:**
441
- - [ ] Critical user flows (checkout, signup)
442
- - [ ] All components (Storybook)
443
- - [ ] Responsive breakpoints
444
- - [ ] Dark/light themes
445
-
507
+ ## 📊 Phase 6 Summary
508
+
509
+ ```
446
510
  ---
447
-
448
- ### Question 6.12: Accessibility Testing
449
-
450
- **How will you test accessibility?**
451
-
452
- A) ⭐ **jest-axe / vitest-axe**
453
- ```typescript
454
- it('has no a11y violations', async () => {
455
- const { container } = render(<Button>Click me</Button>);
456
- const results = await axe(container);
457
- expect(results).toHaveNoViolations();
458
- });
459
- ```
460
- - Best for: Automated a11y checks in unit tests
461
-
462
- B) **@axe-core/playwright / @axe-core/cypress**
463
- - E2E accessibility testing
464
- - Best for: Full-page a11y scans
465
-
466
- C) **Manual testing**
467
- - Screen reader testing, keyboard navigation
468
- - Best for: Comprehensive a11y
469
-
470
- D) **No automated a11y testing**
471
- - Best for: MVPs only (not recommended)
472
-
473
- E) **Combined (automated + manual)**
474
- - Best for: WCAG compliance
475
-
476
- **Your answer:**
477
-
511
+ 📋 PHASE 6 SUMMARY: TESTING STRATEGY
478
512
  ---
479
-
480
- ## 📊 Phase 6 Summary
481
-
482
- ```
483
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
484
- 📋 PHASE 6 SUMMARY: TESTING STRATEGY
485
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
486
-
487
- Unit Testing: [Answer from 6.1]
488
- Component Testing: [Answer from 6.2]
489
- E2E Testing: [Answer from 6.3]
490
- Test Distribution: [Answer from 6.4]
491
- Coverage Targets: [Answer from 6.5]
492
- Snapshot Testing: [Answer from 6.6]
493
- Test Data: [Answer from 6.7]
494
- Mocking Strategy: [Answer from 6.8]
495
- Test Organization: [Answer from 6.9]
496
- CI/CD Execution: [Answer from 6.10]
497
- Visual Regression: [Answer from 6.11]
498
- A11y Testing: [Answer from 6.12]
499
-
500
- Is this correct? (Y/n)
501
- ```
502
-
513
+ Unit Testing: [Answer from 6.1]
514
+ Component Testing: [Answer from 6.2]
515
+ E2E Testing: [Answer from 6.3]
516
+ Test Distribution: [Answer from 6.4]
517
+ Coverage Targets: [Answer from 6.5]
518
+ Snapshot Testing: [Answer from 6.6]
519
+ Test Data: [Answer from 6.7]
520
+ Mocking Strategy: [Answer from 6.8]
521
+ Test Organization: [Answer from 6.9]
522
+ CI/CD Execution: [Answer from 6.10]
523
+ Visual Regression: [Answer from 6.11]
524
+ A11y Testing: [Answer from 6.12]
525
+
526
+ Is this correct? (Y/n)
527
+ ```
503
528
  ---
504
-
505
- ## 📝 Document Generation
506
-
507
- Generate `docs/testing.md` with these placeholders:
508
-
509
- - `{{UNIT_TEST_FRAMEWORK}}` → Vitest / Jest / etc.
510
- - `{{COMPONENT_TEST_LIBRARY}}` → React Testing Library / Vue Test Utils / etc.
511
- - `{{E2E_FRAMEWORK}}` → Playwright / Cypress / etc.
512
- - `{{TEST_DISTRIBUTION}}` → Testing pyramid percentages
513
- - `{{COVERAGE_TARGETS}}` → Coverage thresholds
514
- - `{{SNAPSHOT_TESTING}}` → Yes/No and strategy
515
- - `{{TEST_DATA_STRATEGY}}` → Factory / Fixtures / Faker
516
- - `{{MOCKING_LIBRARY}}` → MSW / Vitest mocks / etc.
517
- - `{{TEST_ORGANIZATION}}` → Collocated / Separate / Mirrored
518
- - `{{CI_STRATEGY}}` → How tests run in CI
519
- - `{{VISUAL_REGRESSION_TOOL}}` → Percy / Playwright / None
520
- - `{{A11Y_TESTING}}` → jest-axe / Manual / Combined
521
-
522
- Update `ai-instructions.md`:
523
-
524
- ```markdown
525
- ## Testing
526
-
527
- - **Unit Tests:** {{UNIT_TEST_FRAMEWORK}}
528
- - **Component Tests:** {{COMPONENT_TEST_LIBRARY}}
529
- - **E2E Tests:** {{E2E_FRAMEWORK}}
530
- - **Coverage:** {{COVERAGE_TARGETS}}
531
-
532
- ### Rules
533
-
534
- - ✅ ALWAYS write tests for new features
535
- - ✅ ALWAYS test user behavior, not implementation details
536
- - ALWAYS use accessible queries (getByRole, getByLabelText)
537
- - ❌ NEVER test implementation details (state, props directly)
538
- - NEVER commit untested code
539
- - ✅ ALWAYS mock external APIs with {{MOCKING_LIBRARY}}
540
- {{#IF_SNAPSHOT_TESTING}}
541
- - ✅ ALWAYS review snapshot changes carefully
542
- {{/IF_SNAPSHOT_TESTING}}
543
- {{#IF_A11Y_TESTING}}
544
- - ✅ ALWAYS include axe accessibility checks in component tests
545
- {{/IF_A11Y_TESTING}}
546
- - ✅ ALWAYS maintain {{COVERAGE_TARGETS}}% code coverage
547
- ```
548
-
529
+ ## 📝 Document Generation
530
+
531
+ Generate `docs/testing.md` with these placeholders:
532
+
533
+ - `{{UNIT_TEST_FRAMEWORK}}` → Vitest / Jest / etc.
534
+ - `{{COMPONENT_TEST_LIBRARY}}` → React Testing Library / Vue Test Utils / etc.
535
+ - `{{E2E_FRAMEWORK}}` → Playwright / Cypress / etc.
536
+ - `{{TEST_DISTRIBUTION}}` → Testing pyramid percentages
537
+ - `{{COVERAGE_TARGETS}}` → Coverage thresholds
538
+ - `{{SNAPSHOT_TESTING}}` → Yes/No and strategy
539
+ - `{{TEST_DATA_STRATEGY}}` → Factory / Fixtures / Faker
540
+ - `{{MOCKING_LIBRARY}}` → MSW / Vitest mocks / etc.
541
+ - `{{TEST_ORGANIZATION}}` → Collocated / Separate / Mirrored
542
+ - `{{CI_STRATEGY}}` → How tests run in CI
543
+ - `{{VISUAL_REGRESSION_TOOL}}` → Percy / Playwright / None
544
+ - `{{A11Y_TESTING}}` → jest-axe / Manual / Combined
545
+
546
+ Update `ai-instructions.md`:
547
+
548
+ ```markdown
549
+ ## Testing
550
+
551
+ - **Unit Tests:** {{UNIT_TEST_FRAMEWORK}}
552
+ - **Component Tests:** {{COMPONENT_TEST_LIBRARY}}
553
+ - **E2E Tests:** {{E2E_FRAMEWORK}}
554
+ - **Coverage:** {{COVERAGE_TARGETS}}
555
+
556
+ ### Rules
557
+
558
+ - ✅ ALWAYS write tests for new features
559
+ - ✅ ALWAYS test user behavior, not implementation details
560
+ - ✅ ALWAYS use accessible queries (getByRole, getByLabelText)
561
+ - NEVER test implementation details (state, props directly)
562
+ - ❌ NEVER commit untested code
563
+ - ALWAYS mock external APIs with {{MOCKING_LIBRARY}}
564
+ {{#IF_SNAPSHOT_TESTING}}
565
+ - ✅ ALWAYS review snapshot changes carefully
566
+ {{/IF_SNAPSHOT_TESTING}}
567
+ {{#IF_A11Y_TESTING}}
568
+ - ✅ ALWAYS include axe accessibility checks in component tests
569
+ {{/IF_A11Y_TESTING}}
570
+ - ✅ ALWAYS maintain {{COVERAGE_TARGETS}}% code coverage
571
+ ```
549
572
  ---
550
-
551
- ## 🚀 Next Steps
552
-
553
- ```
554
- ✅ Phase 6 Complete!
555
-
556
- Documents Generated:
557
- - docs/testing.md
558
- - ai-instructions.md (updated)
559
-
560
- Next: Phase 7 - Performance & Deployment
561
-
562
- Read: .ai-flow/prompts/frontend/flow-build-phase-7-deployment.md
563
- ```
564
-
573
+ ## 🚀 Next Steps
574
+
575
+ ```
576
+ ✅ Phase 6 Complete!
577
+
578
+ Documents Generated:
579
+ - docs/testing.md
580
+ - ai-instructions.md (updated)
581
+
582
+ Next: Phase 7 - Performance & Deployment
583
+
584
+ Read: .ai-flow/prompts/frontend/flow-build-phase-7-deployment.md
585
+ ```
565
586
  ---
566
-
567
- **Last Updated:** 2025-01-XX
568
-
569
- **Version:** 1.2.0
587
+ **Last Updated:** 2025-01-XX
588
+
589
+ **Version:** 1.2.0
590
+
570
591
 
571
592
 
572
593