Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
  • Loading branch information
mmarchini committed Jan 16, 2020
commit 8d9d9dde9db0cfdca2c00272520df2eb42aeb775
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