Repository: unexpectedjs/unexpected
Pull request #407 (2017-07-15 14:07:04)

Drop compatibility with pre-10.10.0 type.diff return values
The diff method used to return { inline: \<boolean\>, diff: \<magicPen\> }, but that was changed in e22bdef68 with a backwards compatibility hack that installed a self-referencing 'diff' property.

I suggest we remove the backwards compatibility in Unexpected 11.

- [x] check up on unexpected-react, which seems to rely on the backwards compatibility.

Depends on these:

* https://github.com/bruderstein/unexpected-htmllike/pull/4
* https://github.com/bruderstein/unexpected-react/pull/45

sunesimonsen: :+1:
On Sat, 15 Jul 2017 at 16.07, Andreas Lind <notifications@github.com> wrote:

> The diff method used to return { inline: , diff: }, but that was changed
> in e22bdef
> <https://github.com/unexpectedjs/unexpected/commit/e22bdef681c9e110b32c0f6d3711e705fcbfce9e>
> with a backwards compatibility hack that installed a self-referencing
> 'diff' property.
>
> I suggest we remove the backwards compatibility in Unexpected 11.
>
>    - check up on unexpected-react, which seems to rely on the backwards
>    compatibility.
>
> ------------------------------
> You can view, comment on, or merge this pull request online at:
>
>   https://github.com/unexpectedjs/unexpected/pull/407
> Commit Summary
>
>    - Drop compatibility with pre-10.10.0 type.diff return values
>
> File Changes
>
>    - *M* lib/Unexpected.js
>    <https://github.com/unexpectedjs/unexpected/pull/407/files#diff-0>
>    (26)
>    - *M* lib/UnexpectedError.js
>    <https://github.com/unexpectedjs/unexpected/pull/407/files#diff-1> (5)
>    - *D* lib/makeDiffResultBackwardsCompatible.js
>    <https://github.com/unexpectedjs/unexpected/pull/407/files#diff-2>
>    (19)
>    - *M* test/api/addType.spec.js
>    <https://github.com/unexpectedjs/unexpected/pull/407/files#diff-3>
>    (37)
>    - *M* test/api/fail.spec.js
>    <https://github.com/unexpectedjs/unexpected/pull/407/files#diff-4>
>    (21)
>
> Patch Links:
>
>    - https://github.com/unexpectedjs/unexpected/pull/407.patch
>    - https://github.com/unexpectedjs/unexpected/pull/407.diff
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/unexpectedjs/unexpected/pull/407>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAFism-j3g6Tgob4caaxuOrmYy3FiV1yks5sOMeIgaJpZM4OZBlT>
> .
>


Patch:
diff --git a/.travis.yml b/.travis.yml
index 4709eab5..20cee0f9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,12 @@
 language: node_js
 node_js:
-  - '6'
-  - '7'
-  - '8.4.0'
-  - '9'
-  - '10'
-script: 'make travis'
+   - "0.10"
+   - "0.12"
+   - "4"
+   - "5"
+   - "6"
+   - "7"
+   - "8.4.0"
+   - "9"
+   - "10"
+script: "make travis"
diff --git a/documentation/api/addType.md b/documentation/api/addType.md
index 9f858232..6e02de1d 100644
--- a/documentation/api/addType.md
+++ b/documentation/api/addType.md
@@ -299,13 +299,13 @@ block. The outputs below shows the contrast between setting the
 inlineDiff = true;
 expect(
   {
-    JohnDoe: new Person('John Doe', 42),
-    JaneDoe: new Person('Janie Doe', 24)
+    'John Doe': new Person('John Doe', 42),
+    'Jane Doe': new Person('Janie Doe', 24)
   },
   'to equal',
   {
-    JohnDoe: new Person('John Doe', 42),
-    JaneDoe: new Person('Jane Doe', 24)
+    'John Doe': new Person('John Doe', 42),
+    'Jane Doe': new Person('Jane Doe', 24)
   }
 );
 ```
@@ -313,18 +313,18 @@ expect(
 ```output
 expected
 {
-  JohnDoe: new Person('John Doe', 42),
-  JaneDoe: new Person('Janie Doe', 24)
+  'John Doe': new Person('John Doe', 42),
+  'Jane Doe': new Person('Janie Doe', 24)
 }
 to equal
 {
-  JohnDoe: new Person('John Doe', 42),
-  JaneDoe: new Person('Jane Doe', 24)
+  'John Doe': new Person('John Doe', 42),
+  'Jane Doe': new Person('Jane Doe', 24)
 }
 
 {
-  JohnDoe: new Person('John Doe', 42),
-  JaneDoe: new Person(
+  'John Doe': new Person('John Doe', 42),
+  'Jane Doe': new Person(
     'Janie Doe', // should be 'Jane Doe'
                  // -Janie Doe
                  // +Jane Doe
@@ -337,13 +337,13 @@ to equal
 inlineDiff = false;
 expect(
   {
-    JohnDoe: new Person('John Doe', 42),
-    JaneDoe: new Person('Janie Doe', 24)
+    'John Doe': new Person('John Doe', 42),
+    'Jane Doe': new Person('Janie Doe', 24)
   },
   'to equal',
   {
-    JohnDoe: new Person('John Doe', 42),
-    JaneDoe: new Person('Jane Doe', 24)
+    'John Doe': new Person('John Doe', 42),
+    'Jane Doe': new Person('Jane Doe', 24)
   }
 );
 ```
@@ -351,25 +351,25 @@ expect(
 ```output
 expected
 {
-  JohnDoe: new Person('John Doe', 42),
-  JaneDoe: new Person('Janie Doe', 24)
+  'John Doe': new Person('John Doe', 42),
+  'Jane Doe': new Person('Janie Doe', 24)
 }
 to equal
 {
-  JohnDoe: new Person('John Doe', 42),
-  JaneDoe: new Person('Jane Doe', 24)
+  'John Doe': new Person('John Doe', 42),
+  'Jane Doe': new Person('Jane Doe', 24)
 }
 
 {
-  JohnDoe: new Person('John Doe', 42),
-  JaneDoe: new Person('Janie Doe', 24) // should equal new Person('Jane Doe', 24)
-                                       //
-                                       // new Person(
-                                       //   'Janie Doe', // should be 'Jane Doe'
-                                       //                // -Janie Doe
-                                       //                // +Jane Doe
-                                       //   24
-                                       // )
+  'John Doe': new Person('John Doe', 42),
+  'Jane Doe': new Person('Janie Doe', 24) // should equal new Person('Jane Doe', 24)
+                                          //
+                                          // new Person(
+                                          //   'Janie Doe', // should be 'Jane Doe'
+                                          //                // -Janie Doe
+                                          //                // +Jane Doe
+                                          //   24
+                                          // )
 }
 ```
 
diff --git a/lib/Unexpected.js b/lib/Unexpected.js
index bef52f2d..a2597c51 100644
--- a/lib/Unexpected.js
+++ b/lib/Unexpected.js
@@ -13,7 +13,6 @@ const defaultDepth = require('./defaultDepth');
 const createWrappedExpectProto = require('./createWrappedExpectProto');
 const AssertionString = require('./AssertionString');
 const throwIfNonUnexpectedError = require('./throwIfNonUnexpectedError');
-const makeDiffResultBackwardsCompatible = require('./makeDiffResultBackwardsCompatible');
 
 function isAssertionArg({ type }) {
   return type.is('assertion');
@@ -817,15 +816,13 @@ Unexpected.prototype.addType = function(type, childUnexpected) {
       );
     }
 
-    return makeDiffResultBackwardsCompatible(
-      baseType.diff(
-        actual,
-        expected,
-        output.clone(),
-        (actual, expected) => that.diff(actual, expected, output.clone()),
-        (value, depth) => output.clone().appendInspected(value, depth),
-        that.equal.bind(that)
-      )
+    return baseType.diff(
+      actual,
+      expected,
+      output.clone(),
+      (actual, expected) => that.diff(actual, expected, output.clone()),
+      (value, depth) => output.clone().appendInspected(value, depth),
+      that.equal.bind(that)
     );
   };
 
@@ -1586,16 +1583,14 @@ Unexpected.prototype.diff = function(
     seen.push(a);
   }
 
-  return makeDiffResultBackwardsCompatible(
-    this.findCommonType(a, b).diff(
-      a,
-      b,
-      output,
-      (actual, expected) =>
-        that.diff(actual, expected, output.clone(), recursions - 1, seen),
-      (v, depth) => output.clone().appendInspected(v, depth),
-      (actual, expected) => that.equal(actual, expected)
-    )
+  return this.findCommonType(a, b).diff(
+    a,
+    b,
+    output,
+    (actual, expected) =>
+      that.diff(actual, expected, output.clone(), recursions - 1, seen),
+    (v, depth) => output.clone().appendInspected(v, depth),
+    (actual, expected) => that.equal(actual, expected)
   );
 };
 
diff --git a/lib/UnexpectedError.js b/lib/UnexpectedError.js
index b5cead74..24acec17 100644
--- a/lib/UnexpectedError.js
+++ b/lib/UnexpectedError.js
@@ -1,7 +1,6 @@
 const utils = require('./utils');
 const defaultDepth = require('./defaultDepth');
 const useFullStackTrace = require('./useFullStackTrace');
-const makeDiffResultBackwardsCompatible = require('./makeDiffResultBackwardsCompatible');
 
 const errorMethodBlacklist = [
   'message',
@@ -71,14 +70,12 @@ UnexpectedError.prototype.buildDiff = function(options) {
   const expect = this.expect;
   return (
     this.createDiff &&
-    makeDiffResultBackwardsCompatible(
-      this.createDiff(
-        output,
-        (actual, expected) => expect.diff(actual, expected, output.clone()),
-        (v, depth) =>
-          output.clone().appendInspected(v, (depth || defaultDepth) - 1),
-        (actual, expected) => expect.equal(actual, expected)
-      )
+    this.createDiff(
+      output,
+      (actual, expected) => expect.diff(actual, expected, output.clone()),
+      (v, depth) =>
+        output.clone().appendInspected(v, (depth || defaultDepth) - 1),
+      (actual, expected) => expect.equal(actual, expected)
     )
   );
 };
diff --git a/lib/assertions.js b/lib/assertions.js
index 58770465..8e356b8b 100644
--- a/lib/assertions.js
+++ b/lib/assertions.js
@@ -1799,35 +1799,27 @@ module.exports = expect => {
       if (valueType.is('array-like') && !subjectIsArrayLike) {
         expect.fail();
       }
-
+      const promiseByKey = {};
+      const keys = valueType.getKeys(value);
       const subjectKeys = subjectType.getKeys(subject);
-      const valueKeys = valueType.getKeys(value);
-      // calculate the unique keys early given enumerability no
-      // longer affects what is included in the list of keys
-      const uniqueKeys = subjectType.uniqueKeys(subjectKeys, valueKeys);
 
-      const promiseByKey = {};
-      let forceExhaustivelyComparison = false;
-      uniqueKeys.forEach((key, index) => {
-        const subjectKey = subjectType.valueForKey(subject, key);
-        const valueKey = valueType.valueForKey(value, key);
-        const valueKeyType = expect.findTypeOf(valueKey);
-        const isDefinedSubjectKey = typeof subjectKey !== 'undefined';
-        const isDefinedValueKey = typeof valueKey !== 'undefined';
-
-        if (expect.flags.exhaustively) {
-          if (valueKeyType.is('expect.it') && !isDefinedSubjectKey) {
-            // ensure value only expect.it key is marked missing
-            forceExhaustivelyComparison = true;
-          }
-        } else {
-          if (isDefinedSubjectKey && !isDefinedValueKey) {
-            // ignore subject only keys unless we are being exhaustive
-            return;
+      if (!subjectIsArrayLike) {
+        // Find all non-enumerable subject keys present in value, but not returned by subjectType.getKeys:
+        keys.forEach(key => {
+          if (
+            Object.prototype.hasOwnProperty.call(subject, key) &&
+            subjectKeys.indexOf(key) === -1
+          ) {
+            subjectKeys.push(key);
           }
-        }
+        });
+      }
 
+      keys.forEach((key, index) => {
         promiseByKey[key] = expect.promise(() => {
+          const subjectKey = subjectType.valueForKey(subject, key);
+          const valueKey = valueType.valueForKey(value, key);
+          const valueKeyType = expect.findTypeOf(valueKey);
           if (valueKeyType.is('expect.it')) {
             expect.context.thisObject = subject;
             return valueKey(subjectKey, expect.context);
@@ -1842,8 +1834,25 @@ module.exports = expect => {
       return expect.promise
         .all([
           expect.promise(() => {
-            if (forceExhaustivelyComparison) {
-              throw new Error('exhaustive comparison failure');
+            if (expect.flags.exhaustively) {
+              const nonOwnKeysWithDefinedValues = keys.filter(
+                key =>
+                  !Object.prototype.hasOwnProperty.call(subject, key) &&
+                  typeof subjectType.valueForKey(subject, key) !== 'undefined'
+              );
+              const valueKeysWithDefinedValues = keys.filter(
+                key => typeof valueType.valueForKey(value, key) !== 'undefined'
+              );
+              const subjectKeysWithDefinedValues = subjectKeys.filter(
+                key =>
+                  typeof subjectType.valueForKey(subject, key) !== 'undefined'
+              );
+              expect(
+                valueKeysWithDefinedValues.length -
+                  nonOwnKeysWithDefinedValues.length,
+                'to equal',
+                subjectKeysWithDefinedValues.length
+              );
             }
           }),
           expect.promise.all(promiseByKey)
@@ -1854,13 +1863,16 @@ module.exports = expect => {
               diff(output, diff, inspect, equal) {
                 output.inline = true;
                 const subjectIsArrayLike = subjectType.is('array-like');
-                // Skip missing keys expected to be missing so they don't get rendered in the diff
-                const keys = uniqueKeys.filter(key => {
-                  return (
-                    subjectType.hasKey(subject, key) ||
-                    typeof valueType.valueForKey(value, key) !== 'undefined'
-                  );
-                });
+                const valueKeys = valueType.getKeys(value);
+                const keys = subjectType
+                  .uniqueKeys(subjectKeys, valueKeys)
+                  .filter(key => {
+                    // Skip missing keys expected to be missing so they don't get rendered in the diff
+                    return (
+                      subjectType.hasKey(subject, key) ||
+                      typeof valueType.valueForKey(value, key) !== 'undefined'
+                    );
+                  });
                 const prefixOutput = subjectType.prefix(
                   output.clone(),
                   subject
@@ -2348,19 +2360,14 @@ module.exports = expect => {
             }
           });
         },
-        err => {
-          if (err.isOperational && !err.propertyIsEnumerable('isOperational')) {
-            delete err.isOperational;
-          }
-
+        err =>
           expect.withError(
             () => expect.shift(err),
             e => {
               e.originalError = err;
               throw e;
             }
-          );
-        }
+          )
       );
     }
   );
diff --git a/lib/makeDiffResultBackwardsCompatible.js b/lib/makeDiffResultBackwardsCompatible.js
deleted file mode 100644
index 379a1928..00000000
--- a/lib/makeDiffResultBackwardsCompatible.js
+++ /dev/null
@@ -1,19 +0,0 @@
-module.exports = function makeDiffResultBackwardsCompatible(diff) {
-  if (diff) {
-    if (diff.isMagicPen) {
-      // New format: { [MagicPen], inline: <boolean> }
-      // Make backwards compatible by adding a 'diff' property that points
-      // to the instance itself.
-      diff.diff = diff;
-    } else {
-      // Old format: { inline: <boolean>, diff: <magicpen> }
-      // Upgrade to the new format by moving the inline property to
-      // the magicpen instance, and remain backwards compatibly by adding
-      // the diff property pointing to the instance itself.
-      diff.diff.inline = diff.inline;
-      diff = diff.diff;
-      diff.diff = diff;
-    }
-  }
-  return diff;
-};
diff --git a/lib/types.js b/lib/types.js
index e7002d6d..132942b0 100644
--- a/lib/types.js
+++ b/lib/types.js
@@ -114,7 +114,7 @@ module.exports = function(expect) {
     },
     getKeys: Object.getOwnPropertySymbols
       ? obj => {
-          const keys = Object.getOwnPropertyNames(obj);
+          const keys = Object.keys(obj);
           const symbols = Object.getOwnPropertySymbols(obj);
           if (symbols.length > 0) {
             return keys.concat(symbols);
@@ -122,7 +122,7 @@ module.exports = function(expect) {
             return keys;
           }
         }
-      : Object.getOwnPropertyNames,
+      : Object.keys,
     // If Symbol support is not detected default to undefined which, when
     // passed to Array.prototype.sort, means "natural" (asciibetical) sort.
     keyComparator:
@@ -154,7 +154,44 @@ module.exports = function(expect) {
           }
         : undefined,
     equal(a, b, equal) {
-      return utils.checkObjectEqualityUsingType(a, b, this, equal);
+      if (a === b) {
+        return true;
+      }
+
+      if (b.constructor !== a.constructor) {
+        return false;
+      }
+
+      const actualKeys = this.getKeys(a).filter(
+        key => typeof this.valueForKey(a, key) !== 'undefined'
+      );
+      const expectedKeys = this.getKeys(b).filter(
+        key => typeof this.valueForKey(b, key) !== 'undefined'
+      );
+
+      // having the same number of owned properties (keys incorporates hasOwnProperty)
+      if (actualKeys.length !== expectedKeys.length) {
+        return false;
+      }
+      //the same set of keys (although not necessarily the same order),
+      actualKeys.sort(this.keyComparator);
+      expectedKeys.sort(this.keyComparator);
+      // cheap key test
+      for (let i = 0; i < actualKeys.length; i += 1) {
+        if (actualKeys[i] !== expectedKeys[i]) {
+          return false;
+        }
+      }
+
+      //equivalent values for every corresponding key, and
+      // possibly expensive deep test
+      for (let j = 0; j < actualKeys.length; j += 1) {
+        const key = actualKeys[j];
+        if (!equal(this.valueForKey(a, key), this.valueForKey(b, key))) {
+          return false;
+        }
+      }
+      return true;
     },
     hasKey(obj, key) {
       return key in obj;
@@ -762,20 +799,12 @@ module.exports = function(expect) {
     'sourceId',
     'sourceURL',
     'stack',
-    'stackArray',
-    '__stackCleaned__',
-    'isOperational' // added by the promise implementation
+    'stackArray'
   ].reduce((result, prop) => {
     result[prop] = true;
     return result;
   }, {});
 
-  if (new Error().hasOwnProperty('arguments')) {
-    // node.js 0.10 adds two extra non-enumerable properties to Error instances:
-    errorMethodBlacklist.arguments = true;
-    errorMethodBlacklist.type = true;
-  }
-
   expect.addType({
     base: 'object',
     name: 'Error',
@@ -797,9 +826,7 @@ module.exports = function(expect) {
     },
     equal(a, b, equal) {
       return (
-        a === b ||
-        (equal(a.message, b.message) &&
-          utils.checkObjectEqualityUsingType(a, b, this, equal))
+        a === b || (equal(a.message, b.message) && this.baseType.equal(a, b))
       );
     },
     inspect(value, depth, output, inspect) {
diff --git a/lib/utils.js b/lib/utils.js
index 20c23bb0..6b8217f8 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -27,48 +27,6 @@ const utils = (module.exports = {
       return a === b;
     }),
 
-  checkObjectEqualityUsingType(a, b, type, isEqual) {
-    if (a === b) {
-      return true;
-    }
-
-    if (b.constructor !== a.constructor) {
-      return false;
-    }
-
-    const actualKeys = type
-      .getKeys(a)
-      .filter(key => typeof type.valueForKey(a, key) !== 'undefined');
-    const expectedKeys = type
-      .getKeys(b)
-      .filter(key => typeof type.valueForKey(b, key) !== 'undefined');
-
-    // having the same number of owned properties (keys incorporates hasOwnProperty)
-    if (actualKeys.length !== expectedKeys.length) {
-      return false;
-    }
-
-    //the same set of keys (although not necessarily the same order),
-    actualKeys.sort(type.keyComparator);
-    expectedKeys.sort(type.keyComparator);
-    // cheap key test
-    for (let i = 0; i < actualKeys.length; i += 1) {
-      if (actualKeys[i] !== expectedKeys[i]) {
-        return false;
-      }
-    }
-
-    //equivalent values for every corresponding key, and
-    // possibly expensive deep test
-    for (let j = 0; j < actualKeys.length; j += 1) {
-      const key = actualKeys[j];
-      if (!isEqual(type.valueForKey(a, key), type.valueForKey(b, key))) {
-        return false;
-      }
-    }
-    return true;
-  },
-
   duplicateArrayLikeUsingType(obj, type) {
     const keys = type.getKeys(obj);
 
diff --git a/package.json b/package.json
index e31cc889..62fe667e 100644
--- a/package.json
+++ b/package.json
@@ -38,8 +38,8 @@
     "babel-preset-es2015-without-strict": "^0.0.4",
     "coveralls": "^3.0.0",
     "es5-shim": "^4.5.9",
-    "eslint": "^5.5.0",
-    "eslint-config-pretty-standard": "^2.0.0",
+    "eslint": "^4.17.0",
+    "eslint-config-pretty-standard": "^1.2.0",
     "eslint-plugin-import": "^2.8.0",
     "eslint-plugin-prettier": "^2.6.0",
     "find-node-modules": "^1.0.4",
@@ -49,14 +49,14 @@
     "jasmine-core": "^3.1.0",
     "jest": "^23.0.0",
     "minimist": "^1.2.0",
-    "mocha": "^5.2.0",
+    "mocha": "^3.2.0",
     "mocha-phantomjs-core": "^2.1.2",
     "mocha-slow-reporter": "^*",
     "node-version-check": "^2.2.0",
-    "nyc": "^13.0.1",
+    "nyc": "^10.3.2",
     "offline-github-changelog": "^1.2.0",
     "prettier": "~1.14.0",
-    "rollup": "^0.65.1",
+    "rollup": "^0.63.0",
     "rollup-plugin-commonjs": "^9.1.0",
     "rollup-plugin-node-globals": "^1.1.0",
     "rollup-plugin-node-resolve": "^3.0.0",


Test patch:
diff --git a/test/api/addType.spec.js b/test/api/addType.spec.js
index 56d7de1b..287e8cb1 100644
--- a/test/api/addType.spec.js
+++ b/test/api/addType.spec.js
@@ -220,48 +220,6 @@ describe('addType', function() {
         );
       });
     });
-
-    it('allows adding a type whose diff method returns an old-style { inline: <boolean>, diff: <magicpen> } object', function() {
-      clonedExpect.addType({
-        name: 'box',
-        identify(obj) {
-          return obj && typeof obj === 'object' && obj.isBox;
-        },
-        equal(a, b, equal) {
-          return a === b || equal(a.value, b.value);
-        },
-        inspect(obj, depth, output, inspect) {
-          return output
-            .text('box(')
-            .append(inspect(obj.value))
-            .text(')');
-        },
-        diff(actual, expected, output, diff) {
-          return {
-            inline: true,
-            diff: output
-              .text('box(')
-              .append(diff({ value: actual.value }, { value: expected.value }))
-              .text(')')
-          };
-        }
-      });
-
-      expect(
-        function() {
-          clonedExpect(box('abc'), 'to equal', box('abe'));
-        },
-        'to throw',
-        "expected box('abc') to equal box('abe')\n" +
-          '\n' +
-          'box({\n' +
-          "  value: 'abc' // should equal 'abe'\n" +
-          '               //\n' +
-          '               // -abc\n' +
-          '               // +abe\n' +
-          '})'
-      );
-    });
   });
 
   describe('#inspect', function() {
diff --git a/test/api/fail.spec.js b/test/api/fail.spec.js
index d10d374e..0b7b3869 100644
--- a/test/api/fail.spec.js
+++ b/test/api/fail.spec.js
@@ -150,26 +150,5 @@ describe('fail assertion', function() {
         "expected 'bar' to foo\n" + '\n' + 'custom'
       );
     });
-
-    it('should support a diff function that uses the old API', function() {
-      var clonedExpect = expect.clone();
-      clonedExpect.addAssertion('<any> to foo', function(expect, subject) {
-        expect.fail({
-          diff(output, diff, inspect, equal) {
-            return {
-              inline: false,
-              diff: output.text('custom')
-            };
-          }
-        });
-      });
-      expect(
-        function() {
-          clonedExpect('bar', 'to foo');
-        },
-        'to throw',
-        "expected 'bar' to foo\n" + '\n' + 'custom'
-      );
-    });
   });
 });
diff --git a/test/api/inspect.spec.js b/test/api/inspect.spec.js
index 92a941b5..bd6877ac 100644
--- a/test/api/inspect.spec.js
+++ b/test/api/inspect.spec.js
@@ -207,9 +207,9 @@ describe('inspect', function() {
             deeply: {
               nested: { object: 'This should not be shown' },
               string: 'should be shown',
-              list: [1, 2, 3]
+              'a list': [1, 2, 3]
             },
-            list: [1, 2, 3]
+            'a list': [1, 2, 3]
           }
         }
       }
@@ -269,8 +269,8 @@ describe('inspect', function() {
         '    circular: { self: [Circular] },\n' +
         '    this: {\n' +
         '      is: {\n' +
-        "        deeply: { nested: ..., string: 'should be shown', list: ... },\n" +
-        '        list: [ 1, 2, 3 ]\n' +
+        "        deeply: { nested: ..., string: 'should be shown', 'a list': ... },\n" +
+        "        'a list': [ 1, 2, 3 ]\n" +
         '      }\n' +
         '    }\n' +
         '  }\n' +
@@ -321,7 +321,7 @@ describe('inspect', function() {
         "      { id: 4, name: 'Barbara Lynn' },\n" +
         "      { id: 5, name: 'Sharpe Downs' }\n" +
         '    ],\n' +
-        "    circular: { self: [Circular] }, this: { is: { deeply: { nested: ..., string: 'should be shown', list: ... }, list: [ 1, 2, 3 ] } }\n" +
+        "    circular: { self: [Circular] }, this: { is: { deeply: { nested: ..., string: 'should be shown', 'a list': ... }, 'a list': [ 1, 2, 3 ] } }\n" +
         '  }\n' +
         ']'
     );
diff --git a/test/assertions/to-have-property.spec.js b/test/assertions/to-have-property.spec.js
index 5460683a..6c255fc4 100644
--- a/test/assertions/to-have-property.spec.js
+++ b/test/assertions/to-have-property.spec.js
@@ -42,24 +42,21 @@ describe('to have property assertion', function() {
           expect(subject, 'to have enumerable property', 'enumFalse');
         },
         'to throw exception',
-        "expected { a: 'b', enumFalse: 't', configFalse: 't', writableFalse: 't' }\n" +
-          "to have enumerable property 'enumFalse'"
+        "expected { a: 'b' } to have enumerable property 'enumFalse'"
       );
       expect(
         function() {
           expect(subject, 'to have configurable property', 'configFalse');
         },
         'to throw exception',
-        "expected { a: 'b', enumFalse: 't', configFalse: 't', writableFalse: 't' }\n" +
-          "to have configurable property 'configFalse'"
+        "expected { a: 'b' } to have configurable property 'configFalse'"
       );
       expect(
         function() {
           expect(subject, 'to have writable property', 'writableFalse');
         },
         'to throw exception',
-        "expected { a: 'b', enumFalse: 't', configFalse: 't', writableFalse: 't' }\n" +
-          "to have writable property 'writableFalse'"
+        "expected { a: 'b' } to have writable property 'writableFalse'"
       );
     });
   });
diff --git a/test/assertions/to-satisfy.spec.js b/test/assertions/to-satisfy.spec.js
index a0a7e0bd..458b29d1 100644
--- a/test/assertions/to-satisfy.spec.js
+++ b/test/assertions/to-satisfy.spec.js
@@ -2194,8 +2194,7 @@ describe('to satisfy assertion', function() {
               });
             },
             'to throw',
-            "expected { nonEnumerable: 'theValue' }\n" +
-              "to exhaustively satisfy { nonEnumerable: 'wrong' }\n" +
+            "expected {} to exhaustively satisfy { nonEnumerable: 'wrong' }\n" +
               '\n' +
               '{\n' +
               '  nonEnumerable:\n' +
@@ -2209,6 +2208,10 @@ describe('to satisfy assertion', function() {
       });
 
       describe('when not matching the non-enumerable property', function() {
+        it('should succeed', function() {
+          expect(bar, 'to exhaustively satisfy', {});
+        });
+
         it('should fail with a diff', function() {
           expect(
             function() {
@@ -2217,11 +2220,9 @@ describe('to satisfy assertion', function() {
               });
             },
             'to throw',
-            "expected { nonEnumerable: 'theValue' }\n" +
-              "to exhaustively satisfy { somethingElse: 'wrong' }\n" +
+            "expected {} to exhaustively satisfy { somethingElse: 'wrong' }\n" +
               '\n' +
               '{\n' +
-              "  nonEnumerable: 'theValue' // should be removed\n" +
               "  // missing somethingElse: 'wrong'\n" +
               '}'
           );
diff --git a/test/types/error-type.spec.js b/test/types/error-type.spec.js
index 230f3ab7..10650341 100644
--- a/test/types/error-type.spec.js
+++ b/test/types/error-type.spec.js
@@ -61,14 +61,8 @@ describe('Error type', function() {
     }
 
     function MyError(message) {
-      var instance = new Error(message);
-      var proto = Object.getPrototypeOf(this);
-      if (Object.setPrototypeOf) {
-        Object.setPrototypeOf(instance, proto);
-      } else {
-        instance.__proto__ = proto; // eslint-disable-line no-proto
-      }
-      return instance;
+      Error.call(this);
+      this.message = message;
     }
 
     inherits(MyError, Error);
@@ -146,16 +140,4 @@ describe('Error type', function() {
       });
     });
   });
-
-  describe('when comparing Error objects with differing enumerable keys', () => {
-    it('should not break', () => {
-      var e1 = new Error('foo');
-      var e2 = new Error();
-      e2.message = 'foo';
-
-      expect(() => {
-        expect(e1, 'to equal', e2);
-      }, 'not to throw');
-    });
-  });
 });