Use the correct Babylon plugins for Test262 tests (#7916)
This commit is contained in:
parent
ac5d2ba984
commit
0a8367c979
@ -6,7 +6,6 @@ const utils = require("./run_babylon_test262_utils");
|
||||
|
||||
const testDir = path.join(__dirname, "../../../build/test262");
|
||||
const whitelistFile = path.join(__dirname, "test262_whitelist.txt");
|
||||
const plugins = ["asyncGenerators", "objectRestSpread", "optionalCatchBinding"];
|
||||
const shouldUpdate = process.argv.indexOf("--update-whitelist") > -1;
|
||||
|
||||
Promise.all([utils.getTests(testDir), utils.getWhitelist(whitelistFile)])
|
||||
@ -21,7 +20,7 @@ Promise.all([utils.getTests(testDir), utils.getWhitelist(whitelistFile)])
|
||||
console.log(`> ${Math.round(100 * idx / total)}% complete`);
|
||||
}
|
||||
|
||||
return utils.runTest(test, plugins);
|
||||
return utils.runTest(test);
|
||||
});
|
||||
|
||||
return utils.interpret(results, whitelist);
|
||||
|
||||
@ -12,6 +12,21 @@ const pfs = {
|
||||
|
||||
const parse = require("../../../packages/babylon").parse;
|
||||
|
||||
const featuresToPlugins = {
|
||||
BigInt: "bigInt",
|
||||
"class-fields-public": "classProperties",
|
||||
"class-fields-private": "classPrivateProperties",
|
||||
"async-iteration": "asyncGenerators",
|
||||
"object-rest": "objectRestSpread",
|
||||
"object-spread": "objectRestSpread",
|
||||
"optional-catch-binding": "optionalCatchBinding",
|
||||
"numeric-separator-literal": "numericSeparator",
|
||||
};
|
||||
|
||||
function getPlugins(features) {
|
||||
return features && features.map(f => featuresToPlugins[f]).filter(Boolean);
|
||||
}
|
||||
|
||||
exports.getTests = function(testDir) {
|
||||
const stream = new TestStream(testDir, { omitRuntime: true });
|
||||
const tests = [];
|
||||
@ -25,6 +40,7 @@ exports.getTests = function(testDir) {
|
||||
fileName,
|
||||
id: `${fileName}(${test.scenario})`,
|
||||
sourceType: test.attrs.flags.module ? "module" : "script",
|
||||
plugins: getPlugins(test.attrs.features),
|
||||
expectedError:
|
||||
!!test.attrs.negative &&
|
||||
(test.attrs.negative.phase === "parse" ||
|
||||
@ -38,9 +54,12 @@ exports.getTests = function(testDir) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.runTest = function(test, plugins) {
|
||||
exports.runTest = function(test) {
|
||||
try {
|
||||
parse(test.contents, { sourceType: test.sourceType, plugins: plugins });
|
||||
parse(test.contents, {
|
||||
sourceType: test.sourceType,
|
||||
plugins: test.plugins,
|
||||
});
|
||||
test.actualError = false;
|
||||
} catch (err) {
|
||||
test.actualError = true;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user