MCPcopy Index your code
hub / github.com/Doorman11991/smallcode / caseBenchDiff

Function caseBenchDiff

test/e2e_smoke.js:199–229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

197// ─── case 3: bench/diff.js sanity ───────────────────────────────────────────
198
199function caseBenchDiff() {
200 console.log('');
201 console.log(paint('Case 3 — bench/diff.js exit codes', C.bold));
202
203 const baseDir = freshTmpDir('e2e-bench-base');
204 const featDir = freshTmpDir('e2e-bench-feat');
205 const baseFile = path.join(baseDir, 'run.json');
206 const featFile = path.join(featDir, 'run.json');
207
208 fs.writeFileSync(baseFile, JSON.stringify({
209 summary: {},
210 results: [
211 { id: 't1', lang: 'py', passed: false, elapsedMs: 1000, toolCalls: 1 },
212 { id: 't2', lang: 'py', passed: true, elapsedMs: 1000, toolCalls: 1 },
213 ],
214 }));
215 fs.writeFileSync(featFile, JSON.stringify({
216 summary: {},
217 results: [
218 { id: 't1', lang: 'py', passed: true, elapsedMs: 1000, toolCalls: 1 },
219 { id: 't2', lang: 'py', passed: true, elapsedMs: 1000, toolCalls: 1 },
220 ],
221 }));
222
223 const r = spawnSync(process.execPath, [path.join(ROOT, 'bench', 'diff.js'), baseFile, featFile, '--json'], { encoding: 'utf-8' });
224 check('exit 0 on improvement', r.status === 0, `status=${r.status}`);
225 let parsed = null;
226 try { parsed = JSON.parse(r.stdout); } catch {}
227 check('emitted JSON verdict IMPROVED', parsed && parsed.verdict === 'IMPROVED',
228 `stdout: ${r.stdout?.slice(0, 200)}`);
229}
230
231// ─── main ────────────────────────────────────────────────────────────────────
232

Callers 1

e2e_smoke.jsFile · 0.85

Calls 3

freshTmpDirFunction · 0.85
paintFunction · 0.70
checkFunction · 0.70

Tested by

no test coverage detected