Skip to content

Commit 2abfe1b

Browse files
committed
[Tests] fix tests in node v6.0 - v6.4
1 parent fa5870d commit 2abfe1b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"nyc": "^10.3.2",
2727
"safe-publish-latest": "^2.0.0",
2828
"safer-buffer": "^2.1.2",
29+
"semver": "^6.3.1",
2930
"string.prototype.repeat": "^1.0.0",
3031
"tape": "^5.9.0"
3132
},

test/values.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var mockProperty = require('mock-property');
66
var hasSymbols = require('has-symbols/shams')();
77
var hasToStringTag = require('has-tostringtag/shams')();
88
var forEach = require('for-each');
9+
var semver = require('semver');
910

1011
test('values', function (t) {
1112
t.plan(1);
@@ -215,6 +216,9 @@ test('Proxies', { skip: typeof Proxy !== 'function' || !hasToStringTag }, functi
215216
var target = { proxy: true };
216217
var fake = new Proxy(target, { has: function () { return false; } });
217218

219+
// needed to work around a weird difference in node v6.0 - v6.4 where non-present properties are not logged
220+
var isNode60 = semver.satisfies(process.version, '6.0 - 6.4');
221+
218222
forEach([
219223
'Boolean',
220224
'Number',
@@ -226,7 +230,7 @@ test('Proxies', { skip: typeof Proxy !== 'function' || !hasToStringTag }, functi
226230

227231
t.equal(
228232
inspect(fake),
229-
'{ proxy: true, [Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
233+
'{ ' + (isNode60 ? '' : 'proxy: true, ') + '[Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
230234
'Proxy for + ' + tag + ' shows as the target, which has no slots'
231235
);
232236
});

0 commit comments

Comments
 (0)