Skip to content

Commit

Permalink
test: skip inferredName on 12
Browse files Browse the repository at this point in the history
V8 changed the function name inference algorithm, which affected one of
our test cases. Even if it's reverted/fixed upstream, it won't make it's
way into v12, so skip that particular test for this version.

Ref: https://bugs.chromium.org/p/v8/issues/detail?id=9807

PR-URL: #330
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
mmarchini committed Jan 21, 2020
1 parent 1faa880 commit 2cc07cd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
7 changes: 7 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
22 changes: 13 additions & 9 deletions test/plugin/frame-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { promisify } = require('util');
const tape = require('tape');

const common = require('../common');
const { nodejsVersion } = common;

const sourceCodes = {
"fnFunctionName": [
Expand Down Expand Up @@ -86,7 +87,8 @@ tape('v8 stack', async (t) => {
t.ok(/<exit>/.test(exit), 'exit frame');
t.ok(/crasher/.test(crasher), 'crasher frame');
t.ok(/<adaptor>/.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');
Expand All @@ -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];
Expand Down

0 comments on commit 2cc07cd

Please sign in to comment.