Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

fix: make things run on Node < 10.5 #150

Merged
merged 2 commits into from
Dec 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import fs from './fs';
import semver from 'semver';
import { quote as shellQuote } from 'shell-quote';


const W3C_WEB_ELEMENT_IDENTIFIER = 'element-6066-11e4-a52e-4f735466cecf';

export function hasContent (val) {
Expand Down Expand Up @@ -257,9 +258,17 @@ async function isSameDestination (path1, path2, ...pathN) {
if (areAllItemsEqual(allPaths)) {
return true;
}
return areAllItemsEqual(await B.map(allPaths, async (x) => (await fs.stat(x, {
bigint: true
})).ino));

// Node 10.5.0 introduced bigint support in stat, which allows for more precision
// however below that the options get interpreted as the callback
// TODO: remove when Node 10 is no longer supported
let mapCb = async (x) => await fs.stat(x, {
bigint: true,
}).ino;
if (semver.lt(process.version, '10.5.0')) {
mapCb = async (x) => await fs.stat(x).ino;
}
return areAllItemsEqual(await B.map(allPaths, mapCb));
}

/**
Expand Down