Closed
Description
Minimum code to reproduce
const { createPatch } = require('diff');
const oldContent = `1st line.\n2nd line.\n3rd line.`;
const newContent = `Z11 thing.\nA New thing.\n2nd line.\nNEW LINE.\n3rd line.\n\nSOMETHING ELSE.`;
const diff = createPatch(
'a.txt',
oldContent,
newContent,
undefined,
undefined,
{ context: 3 },
);
console.log(diff);
Actual Result
===================================================================
--- a.txt
+++ a.txt
@@ -1,3 +1,7 @@
-1st line.
+Z11 thing.
+A New thing.
\ No newline at end of file
2nd line.
-3rd line.
+NEW LINE.
+3rd line.
+
+SOMETHING ELSE.
\ No newline at end of file
Expected Result
===================================================================
--- a.txt
+++ a.txt
@@ -1,3 +1,7 @@
-1st line.
+Z11 thing.
+A New thing.
2nd line.
-3rd line.
\ No newline at end of file
+NEW LINE.
+3rd line.
+
+SOMETHING ELSE.
\ No newline at end of file