By construction (deprecatedTargets first, ..., futureTargets last, and each of those lists written in increasing order) this should be true. However, the test suite does not check this, and it's easy for bugs to creep in. For example,
then attempting to run getAbi('5.0.0', 'electron') throws:
Error: Could not detect abi for version 5.0.0 and runtime electron. Updating "node-abi" might help solve this issue if it is a new release of electron
at Object.getAbi (/path/node-abi/index.js:41:9)
This is because semver.lte('5.0.0-beta.0','5.0.0') === true but 5.0.0 came before 5.0.0-beta.0 in the list being searched.
The main search loop here assumes that
allTargets
is in order: https://github.com/lgeiger/node-abi/blob/9c5acd11ae297c4eabb29c531334dec4b09ebdf3/index.js#L22-L27By construction (
deprecatedTargets
first, ...,futureTargets
last, and each of those lists written in increasing order) this should be true. However, the test suite does not check this, and it's easy for bugs to creep in. For example,then attempting to run
getAbi('5.0.0', 'electron')
throws:This is because
semver.lte('5.0.0-beta.0','5.0.0') === true
but5.0.0
came before5.0.0-beta.0
in the list being searched.See https://github.com/lgeiger/node-abi/pull/62#discussion_r278280059