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

Function parseGeneric

src/tools/run_tests.js:270–287  ·  view source on GitHub ↗
(output, exitCode)

Source from the content-addressed store, hash-verified

268}
269
270function parseGeneric(output, exitCode) {
271 // Last-resort heuristic: look for common pass/fail keywords
272 const result = { passed: 0, failed: 0, errors: 0, skipped: 0, failures: [] };
273
274 const passingM = output.match(/(\d+)\s+(?:tests?\s+)?(?:passed|passing|ok)\b/i);
275 if (passingM) result.passed = parseInt(passingM[1], 10);
276
277 const failingM = output.match(/(\d+)\s+(?:tests?\s+)?(?:failed|failing)\b/i);
278 if (failingM) result.failed = parseInt(failingM[1], 10);
279
280 // Heuristic: if exit code is non-zero and we couldn't detect failures, mark 1
281 if (exitCode !== 0 && result.failed === 0 && result.errors === 0) {
282 result.failed = 1;
283 result.failures.push({ name: '(unknown)', message: output.split('\n').filter(l => l.trim()).slice(-3).join(' ').slice(0, 200) });
284 }
285
286 return result;
287}
288
289function parseOutput(framework, output, exitCode) {
290 switch (framework) {

Callers 2

run_tests.test.jsFile · 0.85
parseOutputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected