(filePath, toolResult)
| 254 | } |
| 255 | |
| 256 | async _tddPostWrite(filePath, toolResult) { |
| 257 | try { |
| 258 | const { getTDDState, _isTestFile } = require('./session/tdd_state'); |
| 259 | const tdd = getTDDState({ workdir: this.config.cwd }); |
| 260 | if (!tdd.loopActive) return toolResult; |
| 261 | const { runTests, formatResult } = require('./tools/run_tests'); |
| 262 | const { getTDDGovernor } = require('./governor/tdd_governor'); |
| 263 | const filter = (!tdd.isRefactor() && !tdd.allRequirementsDone() && tdd.targetTest) ? tdd.targetTest : null; |
| 264 | const testResult = runTests({ workdir: this.config.cwd, test_filter: filter || undefined }); |
| 265 | if (tdd.isIdle() && _isTestFile(filePath || '') && (testResult.failed > 0 || testResult.errors > 0)) { |
| 266 | const name = (testResult.failures[0] && testResult.failures[0].name) || 'new test'; |
| 267 | tdd.beginCycle(name); |
| 268 | } |
| 269 | const tddMsg = getTDDGovernor({ workdir: this.config.cwd }).processTestResult(testResult); |
| 270 | const note = `\n\n[harness] run_tests: ${testResult.summary}${tddMsg ? '\n[TDD] ' + tddMsg : ''}`; |
| 271 | return { ...toolResult, result: (toolResult.result || '') + note }; |
| 272 | } catch { |
| 273 | return toolResult; |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | async _executeTool(name, args) { |
| 278 | const fs = require('fs'); |
no test coverage detected