From ce8e93bad3228bc1404d25fb5727662166e957b8 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Mon, 10 Sep 2018 11:35:37 +0200 Subject: [PATCH] tests: ignore nulls and undefined in the "util.promisify" test --- spec/asar-spec.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/asar-spec.js b/spec/asar-spec.js index e0b88c786ff0..cb8ad1665cbe 100644 --- a/spec/asar-spec.js +++ b/spec/asar-spec.js @@ -895,6 +895,12 @@ describe('asar package', function () { const {hasOwnProperty} = Object.prototype for (const [propertyName, originalValue] of Object.entries(originalFs)) { + // Some properties exist but have a value of `undefined` on some platforms. + // E.g. `fs.lchmod`, which in only available on MacOS, see + // https://nodejs.org/docs/latest-v10.x/api/fs.html#fs_fs_lchmod_path_mode_callback + // Also check for `null`s, `hasOwnProperty()` can't handle them. + if (typeof originalValue === 'undefined' || originalValue === null) continue + if (hasOwnProperty.call(originalValue, util.promisify.custom)) { expect(fs).to.have.own.property(propertyName) .that.has.own.property(util.promisify.custom)