MCPcopy
hub / github.com/Doorman11991/smallcode / _tddPostWrite

Method _tddPostWrite

src/api/index.js:256–275  ·  view source on GitHub ↗
(filePath, toolResult)

Source from the content-addressed store, hash-verified

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');

Callers 1

runMethod · 0.95

Calls 9

getTDDStateFunction · 0.85
runTestsFunction · 0.85
_isTestFileFunction · 0.85
getTDDGovernorFunction · 0.85
isRefactorMethod · 0.80
allRequirementsDoneMethod · 0.80
isIdleMethod · 0.80
beginCycleMethod · 0.80
processTestResultMethod · 0.80

Tested by

no test coverage detected