Skip to content

Commit 7034a17

Browse files
committed
[Tests] key ordering is reversed in node 11+
1 parent 5dbd6c8 commit 7034a17

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/space.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
var test = require('tape');
44
var stringify = require('../');
55

6+
// @ts-expect-error node ensures this will never fail
7+
var isNode10OrLess = parseInt(process.version.match(/^v(\d+)\./)[1], 10) <= 10;
8+
69
test('space parameter', function (t) {
710
t.plan(1);
811
var obj = { one: 1, two: 2 };
@@ -76,7 +79,7 @@ test('space parameter, on a cmp function', function (t) {
7679
var obj = { one: 1, two: 2 };
7780
/** @type {import('..').Comparator & import('../').StableStringifyOptions} */
7881
var cmp = function (a, b) {
79-
return a < b ? 1 : -1;
82+
return (a < b ? 1 : -1) * (isNode10OrLess ? -1 : 1);
8083
};
8184

8285
t.equal(

0 commit comments

Comments
 (0)