Repository: unexpectedjs/unexpected
Pull request #625 (2019-04-24 22:29:26)

Do not highlight "trailing" whitespace in diff chunks that aren't the end of the line
Hopefully this satisfies @Munter's OCD :)

https://gitter.im/unexpectedjs/unexpected?at=5cbf6b256a84d76ed8e20fcd


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 43e5424c..ff0c296b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,27 +1,3 @@
-### v11.3.0 (2019-04-24)
-
-#### Pull requests
-
-- [#624](https://github.com/unexpectedjs/unexpected/pull/624) Truncate large consecutive blocks of unchanged text in the string diff ([Andreas Lind](mailto:andreaslindpetersen@gmail.com), [Sune Simonsen](mailto:sune@we-knowhow.dk))
-- [#622](https://github.com/unexpectedjs/unexpected/pull/622) Don't trigger the footgun protection when a promise is .then\(\)ed but not fully awaited ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
-- [#621](https://github.com/unexpectedjs/unexpected/pull/621) Disallow .hook\(\) on a frozen expect ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
-- [#620](https://github.com/unexpectedjs/unexpected/pull/620) Upgrade nyc to version 14.0.0 ([depfu[bot]](mailto:depfu[bot]@users.noreply.github.com))
-- [#618](https://github.com/unexpectedjs/unexpected/pull/618) Upgrade prettier to version 1.17.0 ([depfu[bot]](mailto:depfu[bot]@users.noreply.github.com))
-- [#619](https://github.com/unexpectedjs/unexpected/pull/619) Upgrade karma to version 4.1.0 ([depfu[bot]](mailto:depfu[bot]@users.noreply.github.com))
-- [#616](https://github.com/unexpectedjs/unexpected/pull/616) Upgrade mocha to version 6.1.2 ([Andreas Lind](mailto:andreaslindpetersen@gmail.com), [depfu[bot]](mailto:depfu[bot]@users.noreply.github.com))
-- [#614](https://github.com/unexpectedjs/unexpected/pull/614) Upgrade jasmine to version 3.4.0 ([depfu[bot]](mailto:depfu[bot]@users.noreply.github.com))
-- [#613](https://github.com/unexpectedjs/unexpected/pull/613) Update the changelog in the preversion hook, avoiding an extra commit ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
-- [#609](https://github.com/unexpectedjs/unexpected/pull/609) No need for the BABEL\_ENV anymore ([Sune Simonsen](mailto:sune@we-knowhow.dk))
-
-#### Commits to master
-
-- [Only run the external tests through Mocha](https://github.com/unexpectedjs/unexpected/commit/168588c8554b9cb5bc40ddb6fc72407bc0fa1545) ([Sune Simonsen](mailto:sune@we-knowhow.dk))
-- [Fixed jest warning](https://github.com/unexpectedjs/unexpected/commit/fc74f69119f0d36f1f06637efa789a23344ff5c9) ([Sune Simonsen](mailto:sune@we-knowhow.dk))
-- [Update offline-github-changelog to ^1.6.1](https://github.com/unexpectedjs/unexpected/commit/cbf209ac644a41cd20f4083ffc733625610dd054) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
-- [Use the version hook instead of preversion](https://github.com/unexpectedjs/unexpected/commit/d21792db4cd1e34cc890bda360d51afd42df5f88) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
-- [Update karma-browserstack-launcher to 1.5.1](https://github.com/unexpectedjs/unexpected/commit/5cff4cd5af2074c3dc1089dd5cb1b37bd2125904) ([Andreas Lind](mailto:andreas.lind@peakon.com))
-- [+2 more](https://github.com/unexpectedjs/unexpected/compare/v11.2.0...v11.3.0)
-
 ### v11.2.0 (2019-03-13)
 
 #### Pull requests
diff --git a/documentation/assertions/string/to-be.md b/documentation/assertions/string/to-be.md
index a02359b6..3837cb56 100644
--- a/documentation/assertions/string/to-be.md
+++ b/documentation/assertions/string/to-be.md
@@ -33,67 +33,3 @@ expect('Hello world!', 'not to be', 'Hello world!');
 ```output
 expected 'Hello world!' not to be 'Hello world!'
 ```
-
-If you compare large strings, we truncate the similar parts:
-
-```js
-var text = `\
-Bacon ipsum amet tri-tip kielbasa kevin spare RIBS. Sirloin chuck jerky
-venison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket
-pastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami
-shoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,
-strip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.
-Strip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage
-bresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto
-short ribs, biltong boudin sausage turkey.
-
-Pork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine
-beef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,
-frankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.
-Pig ground round turducken, pastrami prosciutto ribeye pork ham hock beef
-meatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip
-steak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage
-boudin meatball chuck.`;
-
-var expectedText = `\
-Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky
-venison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket
-pastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami
-shoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,
-strip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.
-Strip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage
-bresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto
-short ribs, biltong boudin sausage turkey.
-
-Pork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine
-beef ribs. Prosciutto boudin pancetta ribs beef short loin porchetta pastrami,
-frankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.
-Pig ground round turducken, pastrami prosciutto ribeye pork ham hock beef
-meatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip
-steak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage
-boudin meatball chuck.`;
-
-expect(text, 'to be', expectedText);
-```
-
-<!-- prettier-ignore -->
-```output
-expected 'Bacon ipsum amet tri-tip kielbasa kevin spare RIBS. Sirloin chuck jerky\nvenison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket\npastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami\nshoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,\nstrip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.\nStrip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage\nbresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto\nshort ribs, biltong boudin sausage turkey.\n\nPork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine\nbeef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,\nfrankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.\nPig ground round turducken, pastrami prosciutto ribeye pork ham hock beef\nmeatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip\nsteak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage\nboudin meatball chuck.'
-to be 'Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky\nvenison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket\npastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami\nshoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,\nstrip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.\nStrip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage\nbresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto\nshort ribs, biltong boudin sausage turkey.\n\nPork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine\nbeef ribs. Prosciutto boudin pancetta ribs beef short loin porchetta pastrami,\nfrankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.\nPig ground round turducken, pastrami prosciutto ribeye pork ham hock beef\nmeatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip\nsteak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage\nboudin meatball chuck.'
-
--Bacon ipsum amet tri-tip kielbasa kevin spare RIBS. Sirloin chuck jerky
-+Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky
- venison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket
- pastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami
- shoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,
-... 3 lines omitted ...
- short ribs, biltong boudin sausage turkey.
- 
- Pork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine
--beef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,
-+beef ribs. Prosciutto boudin pancetta ribs beef short loin porchetta pastrami,
- frankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.
- Pig ground round turducken, pastrami prosciutto ribeye pork ham hock beef
- meatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip
-... 2 lines omitted ...
-```
diff --git a/lib/createTopLevelExpect.js b/lib/createTopLevelExpect.js
index 3c7e819c..b6024421 100644
--- a/lib/createTopLevelExpect.js
+++ b/lib/createTopLevelExpect.js
@@ -1593,15 +1593,11 @@ expectPrototype.child = function() {
     parent.addType(type, childExpect);
     return this;
   };
-  childExpect.exportStyle = function(name, handler, allowRedefinition) {
-    parent.addStyle(
-      name,
-      function(...args) {
-        const childOutput = childExpect.createOutput(this.format);
-        this.append(handler.call(childOutput, ...args) || childOutput);
-      },
-      allowRedefinition
-    );
+  childExpect.exportStyle = function(name, handler) {
+    parent.addStyle(name, function(...args) {
+      const childOutput = childExpect.createOutput(this.format);
+      this.append(handler.call(childOutput, ...args) || childOutput);
+    });
     return this;
   };
   return childExpect;
diff --git a/lib/styles.js b/lib/styles.js
index 2368c883..ab2e7eaa 100644
--- a/lib/styles.js
+++ b/lib/styles.js
@@ -310,14 +310,20 @@ module.exports = expect => {
     ch,
     text,
     baseStyle,
-    markUpSpecialCharacters
+    markUpSpecialCharacters,
+    isAtEol
   ) {
-    text.split(/\n/).forEach(function(line, i, { length }) {
+    const lines = text.split(/\n/);
+    lines.forEach(function(line, i) {
       if (this.isAtStartOfLine()) {
         this.alt({
           text: ch,
           fallback() {
-            if (line === '' && ch !== ' ' && (i === 0 || i !== length - 1)) {
+            if (
+              line === '' &&
+              ch !== ' ' &&
+              (i === 0 || i !== lines.length - 1)
+            ) {
               this[
                 ch === '+' ? 'diffAddedSpecialChar' : 'diffRemovedSpecialChar'
               ]('\\n');
@@ -325,7 +331,8 @@ module.exports = expect => {
           }
         });
       }
-      const matchTrailingSpace = line.match(/^(.*[^ ])?( +)$/);
+      const matchTrailingSpace =
+        (isAtEol || i < lines.length - 1) && line.match(/^(.*[^ ])?( +)$/);
       if (matchTrailingSpace) {
         line = matchTrailingSpace[1] || '';
       }
@@ -351,7 +358,7 @@ module.exports = expect => {
             baseStyle
         ](matchTrailingSpace[2]);
       }
-      if (i !== length - 1) {
+      if (i !== lines.length - 1) {
         this.nl();
       }
     }, this);
@@ -393,28 +400,43 @@ module.exports = expect => {
         if (newEndsWithNewline) {
           newValue = newValue.slice(0, -1);
         }
-        stringDiff[`diff${type}`](oldValue, newValue).forEach(function({
-          added,
-          value,
-          removed
-        }) {
+        stringDiff[`diff${type}`](oldValue, newValue).forEach(function(
+          { added, value, removed },
+          i,
+          lines
+        ) {
+          const isAtEol = i === lines.length - 1;
           if (added) {
             newLine.stringDiffFragment(
               '+',
               value,
               'diffAddedHighlight',
-              options.markUpSpecialCharacters
+              options.markUpSpecialCharacters,
+              isAtEol
             );
           } else if (removed) {
             this.stringDiffFragment(
               '-',
               value,
               'diffRemovedHighlight',
-              options.markUpSpecialCharacters
+              options.markUpSpecialCharacters,
+              isAtEol
             );
           } else {
-            newLine.stringDiffFragment('+', value, 'diffAddedLine');
-            this.stringDiffFragment('-', value, 'diffRemovedLine');
+            newLine.stringDiffFragment(
+              '+',
+              value,
+              'diffAddedLine',
+              undefined,
+              isAtEol
+            );
+            this.stringDiffFragment(
+              '-',
+              value,
+              'diffRemovedLine',
+              undefined,
+              isAtEol
+            );
           }
         },
         this);
@@ -436,14 +458,16 @@ module.exports = expect => {
             '+',
             value,
             'diffAddedLine',
-            options.markUpSpecialCharacters
+            options.markUpSpecialCharacters,
+            endsWithNewline
           );
         } else if (part.removed) {
           this.stringDiffFragment(
             '-',
             value,
             'diffRemovedLine',
-            options.markUpSpecialCharacters
+            options.markUpSpecialCharacters,
+            endsWithNewline
           );
         } else {
           const horizon = 3;
@@ -465,7 +489,7 @@ module.exports = expect => {
                 ' ',
                 value
                   .split('\n')
-                  .slice(-horizon)
+                  .slice(0, horizon)
                   .join('\n'),
                 'text'
               );
diff --git a/lib/types.js b/lib/types.js
index e2fa9736..9f473938 100644
--- a/lib/types.js
+++ b/lib/types.js
@@ -1285,7 +1285,7 @@ module.exports = function(expect) {
     inspect(value, depth, output) {
       return output.singleQuotedString(value);
     },
-    diffLimit: 65536,
+    diffLimit: 4096,
     diff(actual, expected, output, diff, inspect) {
       if (Math.max(actual.length, expected.length) > this.diffLimit) {
         output.jsComment(`Diff suppressed due to size > ${this.diffLimit}`);
diff --git a/package.json b/package.json
index 19b40446..aa56ecc7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "unexpected",
-  "version": "11.3.0",
+  "version": "11.2.0",
   "author": "Sune Sloth Simonsen <sune@we-knowhow.dk>",
   "keywords": [
     "assertion",
@@ -86,15 +86,9 @@
     "setupFiles": [
       "<rootDir>/test/promisePolyfill"
     ],
-    "setupFilesAfterEnv": [
-      "<rootDir>/test/common.js"
-    ],
+    "setupTestFrameworkScriptFile": "<rootDir>/test/common.js",
     "testMatch": [
-      "<rootDir>/test/*.spec.js",
-      "<rootDir>/test/**/*.spec.js"
-    ],
-    "testPathIgnorePatterns": [
-      "<rootDir>/test/external.spec.js"
+      "<rootDir>/test/**.spec.js"
     ],
     "testURL": "http://localhost/",
     "transformIgnorePatterns": [


Test patch:
diff --git a/test/api/exportStyle.spec.js b/test/api/exportStyle.spec.js
index a354048f..4b5683f7 100644
--- a/test/api/exportStyle.spec.js
+++ b/test/api/exportStyle.spec.js
@@ -64,30 +64,4 @@ describe('styleType', () => {
       '>>yadda<<'
     );
   });
-
-  it('passes on the allowRedefinition parameter', function() {
-    parentExpect.addStyle('fancyQuotes', function(text) {
-      this.text('"')
-        .text(text)
-        .text('"');
-    });
-    childExpect.exportStyle(
-      'fancyQuotes',
-      function(text) {
-        this.text('>>')
-          .text(text)
-          .text('<<');
-      },
-      true
-    );
-
-    expect(
-      parentExpect
-        .createOutput()
-        .fancyQuotes('yadda')
-        .toString(),
-      'to equal',
-      '>>yadda<<'
-    );
-  });
 });
diff --git a/test/assertions/to-be.spec.js b/test/assertions/to-be.spec.js
index 8f9ae12d..11a2b01b 100644
--- a/test/assertions/to-be.spec.js
+++ b/test/assertions/to-be.spec.js
@@ -78,135 +78,6 @@ describe('to be assertion', () => {
       );
     });
 
-    it('truncates lines in large diffs', () => {
-      const paragraphs = `\
-        Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky
-        venison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket
-        pastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami
-        shoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,
-        strip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.
-        Strip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage
-        bresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto
-        short ribs, biltong boudin sausage turkey.
-
-        Pork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine
-        beef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,
-        frankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.
-        Pig ground round turducken, prosciutto pastrami ribeye pork ham hock beef
-        meatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip
-        steak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage
-        boudin meatball chuck.`.replace(/^ {8}/gm, '');
-
-      const modifiedParagraphs = `\
-        Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky
-        venison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket
-        pastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami
-        shoulder buffalo boudin salami spare ribs. Bresaola picanha tri-tip,
-        strip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.
-        Strip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage
-        bresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto
-        short ribs, biltong boudin sausage turkey.
-
-        Pork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine
-        beef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,
-        frankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.
-        Pig ground round turducken, pastrami prosciutto ribeye pork ham hock beef
-        meatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip
-        steak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage
-        boudin meatball chuck.`.replace(/^ {8}/gm, '');
-
-      const expectedOutput = `\
-        expected 'Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky\\nvenison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket\\npastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami\\nshoulder buffalo boudin salami spare ribs. Bresaola picanha tri-tip,\\nstrip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.\\nStrip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage\\nbresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto\\nshort ribs, biltong boudin sausage turkey.\\n\\nPork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine\\nbeef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,\\nfrankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.\\nPig ground round turducken, pastrami prosciutto ribeye pork ham hock beef\\nmeatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip\\nsteak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage\\nboudin meatball chuck.'
-        to equal 'Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky\\nvenison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket\\npastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami\\nshoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,\\nstrip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.\\nStrip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage\\nbresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto\\nshort ribs, biltong boudin sausage turkey.\\n\\nPork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine\\nbeef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,\\nfrankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.\\nPig ground round turducken, prosciutto pastrami ribeye pork ham hock beef\\nmeatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip\\nsteak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage\\nboudin meatball chuck.'
-
-         Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky
-         venison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket
-         pastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami
-        -shoulder buffalo boudin salami spare ribs. Bresaola picanha tri-tip,
-        +shoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,
-         strip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.
-         Strip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage
-         bresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto
-        ... 2 lines omitted ...
-         Pork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine
-         beef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,
-         frankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.
-        -Pig ground round turducken, pastrami prosciutto ribeye pork ham hock beef
-        +Pig ground round turducken, prosciutto pastrami ribeye pork ham hock beef
-         meatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip
-         steak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage
-         boudin meatball chuck.`.replace(/^ {8}/gm, '');
-
-      expect(
-        () => {
-          expect(modifiedParagraphs, 'to equal', paragraphs);
-        },
-        'to throw',
-        expectedOutput
-      );
-    });
-
-    it('truncates lines in large in the start and end', () => {
-      const paragraphs = `\
-        Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky
-        venison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket
-        pastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami
-        shoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,
-        strip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.
-        Strip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage
-        bresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto
-        short ribs, biltong boudin sausage turkey.
-
-        Pork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine
-        beef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,
-        frankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.
-        Pig ground round turducken, prosciutto pastrami ribeye pork ham hock beef
-        meatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip
-        steak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage
-        boudin meatball chuck.`.replace(/^ {8}/gm, '');
-
-      const modifiedParagraphs = `\
-        Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky
-        venison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket
-        pastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami
-        shoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,
-        strip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.
-        Strip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage
-        bresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto
-        short ribs, biltong sausage boudin turkey.
-
-        Pork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine
-        beef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,
-        frankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.
-        Pig ground round turducken, prosciutto pastrami ribeye pork ham hock beef
-        meatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip
-        steak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage
-        boudin meatball chuck.`.replace(/^ {8}/gm, '');
-
-      const expectedOutput = `\
-        expected 'Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky\\nvenison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket\\npastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami\\nshoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,\\nstrip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.\\nStrip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage\\nbresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto\\nshort ribs, biltong sausage boudin turkey.\\n\\nPork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine\\nbeef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,\\nfrankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.\\nPig ground round turducken, prosciutto pastrami ribeye pork ham hock beef\\nmeatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip\\nsteak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage\\nboudin meatball chuck.'
-        to equal 'Bacon ipsum dolor amet tri-tip kielbasa kevin spare ribs. Sirloin chuck jerky\\nvenison leberkas. T-bone alcatra short loin short ribs spare ribs rump, brisket\\npastrami frankfurter corned beef kielbasa fatback cupim andouille. Pastrami\\nshoulder buffalo boudin pork belly salami spare ribs. Bresaola picanha tri-tip,\\nstrip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.\\nStrip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage\\nbresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto\\nshort ribs, biltong boudin sausage turkey.\\n\\nPork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine\\nbeef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,\\nfrankfurter corned beef. Leberkas buffalo alcatra, chuck pancetta sirloin pig.\\nPig ground round turducken, prosciutto pastrami ribeye pork ham hock beef\\nmeatloaf turkey kielbasa. Tenderloin porchetta biltong burgdoggen sirloin, strip\\nsteak pastrami ham hock beef spare ribs shank kevin bacon. Pork loin sausage\\nboudin meatball chuck.'
-
-        ... 4 lines omitted ...
-         strip steak swine short loin rump corned beef doner chuck sirloin burgdoggen.
-         Strip steak fatback frankfurter salami pastrami short ribs spare ribs, sausage
-         bresaola porchetta turducken shoulder brisket. Tri-tip beef ribs prosciutto
-        -short ribs, biltong sausage boudin turkey.
-        +short ribs, biltong boudin sausage turkey.
-         
-         Pork chop venison beef ribs leberkas pork filet mignon. Boudin leberkas swine
-         beef ribs. Prosciutto boudin pancetta beef ribs short loin porchetta pastrami,
-        ... 5 lines omitted ...`.replace(/^ {8}/gm, '');
-
-      expect(
-        () => {
-          expect(modifiedParagraphs, 'to equal', paragraphs);
-        },
-        'to throw',
-        expectedOutput
-      );
-    });
-
     it('does not provide a diff when comparing against undefined', () => {
       expect(
         function() {
diff --git a/test/jest.es5.config.json b/test/jest.es5.config.json
index 349aab65..02a06395 100644
--- a/test/jest.es5.config.json
+++ b/test/jest.es5.config.json
@@ -1,5 +1,5 @@
 {
   "setupFiles": ["<rootDir>/build/test/promisePolyfill.js"],
-  "setupFilesAfterEnv": ["<rootDir>/build/test/common.js"],
+  "setupTestFrameworkScriptFile": "<rootDir>/build/test/common.js",
   "testMatch": ["<rootDir>/build/test/**.spec.js"]
 }
diff --git a/test/styles/stringDiff.spec.js b/test/styles/stringDiff.spec.js
index 65ca307e..83a64e18 100644
--- a/test/styles/stringDiff.spec.js
+++ b/test/styles/stringDiff.spec.js
@@ -142,6 +142,24 @@ describe('stringDiff', () => {
       );
     });
 
+    it('does not highlight "trailing" whitespace in removed and added chunks within a line', () => {
+      expect(
+        expect
+          .createOutput('ansi')
+          .stringDiff('foo bar quux baz', 'foo quux bar baz'),
+        'to equal',
+        expect
+          .createOutput('ansi')
+          .diffRemovedLine('foo bar ')
+          .diffRemovedHighlight('quux ')
+          .diffRemovedLine('baz')
+          .nl()
+          .diffAddedLine('foo ')
+          .diffAddedHighlight('quux ')
+          .diffAddedLine('bar baz')
+      );
+    });
+
     it('does not highlight trailing whitespace in an unchanged line', () => {
       expect(
         expect.createOutput('ansi').stringDiff('foo  \nbar', 'foo  \nquux'),
diff --git a/test/support/jasmine.json b/test/support/jasmine.json
index d3b40ad4..a6d59c26 100644
--- a/test/support/jasmine.json
+++ b/test/support/jasmine.json
@@ -1,6 +1,8 @@
 {
   "spec_dir": "test",
-  "spec_files": ["**/*.spec.js", "!external.spec.js"],
+  "spec_files": [
+    "**/*.spec.js"
+  ],
   "helpers": [
     "common.js",
     "promisePolyfill.js",
diff --git a/test/types/string-type.spec.js b/test/types/string-type.spec.js
index 02c7dd09..4331806c 100644
--- a/test/types/string-type.spec.js
+++ b/test/types/string-type.spec.js
@@ -1,24 +1,24 @@
 /* global expect */
 describe('string type', () => {
-  it('should suppress a diff when the actual value has a length greater than 64 KB', () => {
-    var longString = new Array(65538).join('A');
+  it('should suppress a diff when the actual value has a length greater than 1 KB', () => {
+    var longString = new Array(4098).join('A');
     expect(
       function() {
         expect(longString, 'to equal', 'foo');
       },
       'to throw',
-      `expected '${longString}'\nto equal 'foo'\n\nDiff suppressed due to size > 65536`
+      `expected '${longString}'\nto equal 'foo'\n\nDiff suppressed due to size > 4096`
     );
   });
 
-  it('should suppress a diff when the expected value has a length greater than 64 KB', () => {
-    var longString = new Array(65538).join('A');
+  it('should suppress a diff when the expected value has a length greater than 4 KB', () => {
+    var longString = new Array(4098).join('A');
     expect(
       function() {
         expect('foo', 'to equal', longString);
       },
       'to throw',
-      `expected 'foo'\nto equal '${longString}'\n\nDiff suppressed due to size > 65536`
+      `expected 'foo'\nto equal '${longString}'\n\nDiff suppressed due to size > 4096`
     );
   });
 });