Skip to content

Commit

Permalink
Update test262 to latest commit and enable mapping for features
Browse files Browse the repository at this point in the history
Also added an automated check for new features which are not mapped or ignored
  • Loading branch information
danez authored and nicolo-ribaudo committed Nov 4, 2018
1 parent d35563e commit 1d4d760
Show file tree
Hide file tree
Showing 4 changed files with 1,106 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
@@ -1,6 +1,6 @@
MAKEFLAGS = -j1
FLOW_COMMIT = bea8b83f50f597454941d2a7ecef6e93a881e576
TEST262_COMMIT = 06c2f019019cf7850923de4d56828e6dfd9212b8
TEST262_COMMIT = 72f1cfa2abd66a69b29e9b7d691a8ae8c5a7a00f

# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
export FORCE_COLOR = true
Expand Down Expand Up @@ -96,7 +96,7 @@ test-flow-update-whitelist:
bootstrap-test262:
rm -rf ./build/test262
mkdir -p ./build
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/tc39/test262.git ./build/test262
git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/tc39/test262.git ./build/test262
cd build/test262 && git checkout $(TEST262_COMMIT)

test-test262:
Expand Down
14 changes: 14 additions & 0 deletions scripts/tests/test262/run_babel_parser_test262.js
Expand Up @@ -105,6 +105,20 @@ Promise.all([utils.getTests(testDir), utils.getWhitelist(whitelistFile)])
} else {
process.exitCode = summary.passed ? 0 : 1;
}

const unmappedFeatures = utils.getUnmappedFeatures();

if (unmappedFeatures.size) {
console.log("");
console.log(
"The following Features are not currently mapped or ignored:"
);
console.log(
Array.from(unmappedFeatures)
.join("\n")
.replace(/^/gm, " ")
);
}
})
.catch(function(err) {
console.error(err);
Expand Down
113 changes: 112 additions & 1 deletion scripts/tests/test262/run_babel_parser_test262_utils.js
Expand Up @@ -12,22 +12,133 @@ const pfs = {

const parse = require("../../../packages/babel-parser").parse;

const ignoredFeatures = [
"async-functions",
"arrow-function",
"class",
"const",
"destructuring-assignment",
"for-of",
"generators",
"let",
"template",
"Reflect.construct",
"Symbol",
"TypedArray",
"cross-realm",
"Reflect",
"DataView",
"ArrayBuffer",
"Symbol.toStringTag",
"Atomics",
"SharedArrayBuffer",
"Int8Array",
"Symbol.toPrimitive",
"caller",
"Symbol.iterator",
"u180e",
"Proxy",
"Symbol.match",
"regexp-dotall",
"Symbol.matchAll",
"Set",
"WeakSet",
"globalThis",
"Intl.Locale",
"tail-call-optimization",
"default-parameters",
"new.target",
"super",
"Symbol.unscopables",
"Symbol.species",
"Symbol.asyncIterator",
"Float32Array",
"Float64Array",
"Uint16Array",
"Uint8Array",
"Uint8ClampedArray",
"computed-property-names",
"well-formed-json-stringify",
"Object.fromEntries",
"Object.is",
"Reflect.setPrototypeOf",
"Reflect.set",
"String.fromCodePoint",
"regexp-lookbehind",
"regexp-named-groups",
"regexp-unicode-property-escapes",
"Symbol.hasInstance",
"Symbol.isConcatSpreadable",
"Symbol.replace",
"Symbol.search",
"Symbol.split",
"Array.prototype.values",
"Intl.ListFormat",
"Intl.RelativeTimeFormat",
"Intl.Segmenter",
"destructuring-binding",
"json-superset",
"Map",
"IsHTMLDDA",
"Array.prototype.flat",
"Array.prototype.flatMap",
"DataView.prototype.setUint8",
"DataView.prototype.getFloat32",
"DataView.prototype.getFloat64",
"DataView.prototype.getInt16",
"DataView.prototype.getInt32",
"DataView.prototype.getInt8",
"DataView.prototype.getUint16",
"DataView.prototype.getUint32",
"WeakMap",
"Promise.prototype.finally",
"String.prototype.endsWith",
"String.prototype.includes",
"String.prototype.matchAll",
"string-trimming",
"String.prototype.trimEnd",
"String.prototype.trimStart",
"Symbol.prototype.description",
];

const featuresToPlugins = {
"async-iteration": "asyncGenerators",
BigInt: "bigInt",
"class-fields-private": "classPrivateProperties",
"class-fields-public": "classProperties",
"class-methods-private": "classPrivateMethods",
"class-static-fields-public": "classProperties",
"class-static-fields-private": "classPrivateProperties",
"class-static-methods-private": "classPrivateMethods",
"dynamic-import": "dynamicImport",
"export-star-as-namespace-from-module": "exportNamespaceFrom",
"import.meta": "importMeta",
"numeric-separator-literal": "numericSeparator",
"object-rest": "objectRestSpread",
"object-spread": "objectRestSpread",
"optional-catch-binding": "optionalCatchBinding",
};

function getPlugins(features) {
return features && features.map(f => featuresToPlugins[f]).filter(Boolean);
return (
features &&
features
.map(f => {
if (!featuresToPlugins[f] && !ignoredFeatures.includes(f)) {
unmappedFeatures.add(f);
}
return featuresToPlugins[f];
})
.filter(Boolean)
);
}

const unmappedFeatures = new Set();

exports.getUnmappedFeatures = function() {
return unmappedFeatures;
};

exports.getTests = function(testDir) {
const stream = new TestStream(testDir, {
omitRuntime: true,
Expand Down

0 comments on commit 1d4d760

Please sign in to comment.