diff --git a/test/common.js b/test/common.js index 50731a05..14b890e9 100644 --- a/test/common.js +++ b/test/common.js @@ -332,3 +332,10 @@ Session.prototype.hasSymbol = function hasSymbol(symbol, callback) { } }); }; + +function nodejsVersion() { + const version = process.version.substring(1, process.version.indexOf('-')); + const versionArray = version.split('.').map(s => Number(s)); + return versionArray; +} +exports.nodejsVersion = nodejsVersion; diff --git a/test/plugin/frame-test.js b/test/plugin/frame-test.js index f4304e91..7766b8a2 100644 --- a/test/plugin/frame-test.js +++ b/test/plugin/frame-test.js @@ -5,6 +5,7 @@ const { promisify } = require('util'); const tape = require('tape'); const common = require('../common'); +const { nodejsVersion } = common; const sourceCodes = { "fnFunctionName": [ @@ -86,7 +87,8 @@ tape('v8 stack', async (t) => { t.ok(//.test(exit), 'exit frame'); t.ok(/crasher/.test(crasher), 'crasher frame'); t.ok(//.test(adapter), 'arguments adapter frame'); - t.ok(/\sfnInferredName\(/.test(fnInferredName), 'fnInferredName frame'); + if (nodejsVersion()[0] < 12) + t.ok(/\sfnInferredName\(/.test(fnInferredName), 'fnInferredName frame'); t.ok(/\sModule.fnInferredNamePrototype\(/.test(fnInferredNamePrototype), 'fnInferredNamePrototype frame'); t.ok(/\sfnFunctionName\(/.test(fnFunctionName), 'fnFunctionName frame'); @@ -111,14 +113,16 @@ tape('v8 stack', async (t) => { fatalError(t, sess, "Couldn't determine fnFunctionName's frame number"); } - const fnInferredNamePrototypeFrame = - fnInferredNamePrototype.match(/frame #([0-9]+)/)[1]; - if (fnInferredNamePrototypeFrame) { - await testFrameList(t, sess, fnInferredNamePrototypeFrame, - sourceCodes['fnInferredNamePrototype']); - } else { - fatalError(t, sess, - "Couldn't determine fnInferredNamePrototype's frame number"); + if (nodejsVersion()[0] < 12) { + const fnInferredNamePrototypeFrame = + fnInferredNamePrototype.match(/frame #([0-9]+)/)[1]; + if (fnInferredNamePrototypeFrame) { + await testFrameList(t, sess, fnInferredNamePrototypeFrame, + sourceCodes['fnInferredNamePrototype']); + } else { + fatalError(t, sess, + "Couldn't determine fnInferredNamePrototype's frame number"); + } } const fnInferredNameFrame = fnInferredName.match(/frame #([0-9]+)/)[1];