Skip to content

Commit 2cc07cd

Browse files
committed
test: skip inferredName on 12
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>
1 parent 1faa880 commit 2cc07cd

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

test/common.js

+7
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,10 @@ Session.prototype.hasSymbol = function hasSymbol(symbol, callback) {
332332
}
333333
});
334334
};
335+
336+
function nodejsVersion() {
337+
const version = process.version.substring(1, process.version.indexOf('-'));
338+
const versionArray = version.split('.').map(s => Number(s));
339+
return versionArray;
340+
}
341+
exports.nodejsVersion = nodejsVersion;

test/plugin/frame-test.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { promisify } = require('util');
55
const tape = require('tape');
66

77
const common = require('../common');
8+
const { nodejsVersion } = common;
89

910
const sourceCodes = {
1011
"fnFunctionName": [
@@ -86,7 +87,8 @@ tape('v8 stack', async (t) => {
8687
t.ok(/<exit>/.test(exit), 'exit frame');
8788
t.ok(/crasher/.test(crasher), 'crasher frame');
8889
t.ok(/<adaptor>/.test(adapter), 'arguments adapter frame');
89-
t.ok(/\sfnInferredName\(/.test(fnInferredName), 'fnInferredName frame');
90+
if (nodejsVersion()[0] < 12)
91+
t.ok(/\sfnInferredName\(/.test(fnInferredName), 'fnInferredName frame');
9092
t.ok(/\sModule.fnInferredNamePrototype\(/.test(fnInferredNamePrototype),
9193
'fnInferredNamePrototype frame');
9294
t.ok(/\sfnFunctionName\(/.test(fnFunctionName), 'fnFunctionName frame');
@@ -111,14 +113,16 @@ tape('v8 stack', async (t) => {
111113
fatalError(t, sess, "Couldn't determine fnFunctionName's frame number");
112114
}
113115

114-
const fnInferredNamePrototypeFrame =
115-
fnInferredNamePrototype.match(/frame #([0-9]+)/)[1];
116-
if (fnInferredNamePrototypeFrame) {
117-
await testFrameList(t, sess, fnInferredNamePrototypeFrame,
118-
sourceCodes['fnInferredNamePrototype']);
119-
} else {
120-
fatalError(t, sess,
121-
"Couldn't determine fnInferredNamePrototype's frame number");
116+
if (nodejsVersion()[0] < 12) {
117+
const fnInferredNamePrototypeFrame =
118+
fnInferredNamePrototype.match(/frame #([0-9]+)/)[1];
119+
if (fnInferredNamePrototypeFrame) {
120+
await testFrameList(t, sess, fnInferredNamePrototypeFrame,
121+
sourceCodes['fnInferredNamePrototype']);
122+
} else {
123+
fatalError(t, sess,
124+
"Couldn't determine fnInferredNamePrototype's frame number");
125+
}
122126
}
123127

124128
const fnInferredNameFrame = fnInferredName.match(/frame #([0-9]+)/)[1];

0 commit comments

Comments
 (0)