Verified Commit be73eb2f authored by Camil Staps's avatar Camil Staps 🙂

Output patches instead of full diffs

parent ba7f7c0b
......@@ -105,16 +105,10 @@ function runTestCase(testcase) {
} else {
process.stderr.write(RED + testcase.name + ' failed.' + RESET + '\n');
process.exitCode = 1;
var diff = jsdiff.diffLines(testcase.result, result);
diff.forEach(function(part){
var color = '';
if ('added' in part && typeof part.added != 'undefined' && part.added)
color = GREEN;
if ('removed' in part && typeof part.removed != 'undefined' && part.removed)
color = RED;
process.stderr.write(color + part.value + RESET);
});
process.stderr.write('\n');
var patch = jsdiff.createPatch(testcase.name + '.result',
testcase.result, result,
'Expected result', 'Actual result');
process.stderr.write('\n ' + patch.replace(/\n/g, '\n ') + '\n');
}
return passed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment