Skip to content

Commit

Permalink
[Tests] only use Buffer.from when it has a length of > 1
Browse files Browse the repository at this point in the history
This avoids tests throwing "not a typed array" in node v5.0-v5.9 + v4.0-v4.4
  • Loading branch information
ljharb committed Dec 1, 2019
1 parent f0d4a42 commit f7e5776
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/cmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ test('dates', function (t) {
});

test('buffers', { skip: typeof Buffer !== 'function' }, function (t) {
var safeBuffer = Buffer.from || Buffer;
var safeBuffer = Buffer.from && Buffer.from.length > 1 ? Buffer.from : Buffer;
t.deepEqualTest(
safeBuffer('xyz'),
safeBuffer('xyz'),
Expand Down

0 comments on commit f7e5776

Please sign in to comment.