Skip to content

Commit c4c7636

Browse files
committed
fix getting current Node.js version
Without this, `nodejsVersion()` returns `[NaN]` when using a release build of Node.js.
1 parent 1924ea2 commit c4c7636

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/common.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@ Session.prototype.hasSymbol = function hasSymbol(symbol, callback) {
334334
};
335335

336336
function nodejsVersion() {
337-
const version = process.version.substring(1, process.version.indexOf('-'));
337+
const candidateIndex = process.version.indexOf('-');
338+
const endIndex = candidateIndex != -1 ? candidateIndex : process.version.length;
339+
const version = process.version.substring(1, endIndex);
338340
const versionArray = version.split('.').map(s => Number(s));
339341
return versionArray;
340342
}

0 commit comments

Comments
 (0)