(testResult)
| 241 | } |
| 242 | |
| 243 | confirmRed(testResult) { |
| 244 | if (this.disabled) return { ok: true, phase: 'idle', message: 'TDD gating disabled.' }; |
| 245 | if (this._phase !== PHASES.RED) { |
| 246 | return { ok: false, phase: this._phase, message: `confirmRed called but phase is "${this._phase}", expected "red".` }; |
| 247 | } |
| 248 | |
| 249 | if (!this._isTargetFailing(testResult) && testResult && testResult.failed === 0 && testResult.exitCode === 0) { |
| 250 | return { |
| 251 | ok: false, |
| 252 | phase: PHASES.RED, |
| 253 | message: `RED phase confirmation failed: all tests passed — "${this._targetTest}" is not failing yet. ` + |
| 254 | 'Write the test first, then call run_tests to confirm it fails before implementing.', |
| 255 | }; |
| 256 | } |
| 257 | |
| 258 | this._redConfirmed = true; |
| 259 | this._save(); |
| 260 | |
| 261 | return { |
| 262 | ok: true, |
| 263 | phase: PHASES.RED, |
| 264 | message: `RED confirmed: "${this._targetTest}" is failing. Now write the minimum implementation to make it pass.`, |
| 265 | }; |
| 266 | } |
| 267 | |
| 268 | advanceToGreen(testResult) { |
| 269 | if (this.disabled) return { ok: true, phase: 'idle', message: 'TDD gating disabled.' }; |
no test coverage detected