From 40df4a8a86daaef373971b53761019c1cefc6d1c Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 19 Jan 2023 11:37:50 -0500 Subject: [PATCH] [ez] Update test262-preprocessor to use the same config as hir-test --- compiler/forget/scripts/test262-preprocessor.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/compiler/forget/scripts/test262-preprocessor.js b/compiler/forget/scripts/test262-preprocessor.js index e42fce7f4b..919a08c1fe 100644 --- a/compiler/forget/scripts/test262-preprocessor.js +++ b/compiler/forget/scripts/test262-preprocessor.js @@ -1,24 +1,15 @@ -const BabelPluginReactForget = require("../dist/Babel/BabelPlugin").default; -const transformSync = require("@babel/core").transformSync; +const runReactForgetBabelPlugin = require("../dist/Babel/RunReactForgetBabelPlugin"); // Preprocessor that runs Forget on the test262 test prior to execution. Compilation errors short // circuit test execution and report an error immediately. module.exports = (test) => { try { - const generated = transformSync(test.contents, { - filename: test.file, - plugins: [BabelPluginReactForget], - }); - if (generated.code != null && generated.code !== "") { - test.contents = generated.code; - } else { - throw new Error("Codegen returned an empty string"); - } + test.contents = runReactForgetBabelPlugin(test.contents, test.file).code; } catch (error) { // We use the `stderr` output to group errors so we can count them, so we need to dedupe errors // that are the same but differ slightly. let { name, message } = error; - message = message.replace(/\/.*\.js:\s/, ""); // babel seems to output filenames + message = message.replace(/^\/.*?:\s/, ""); // babel seems to output filenames message = message.split(/\(\d+:\d+\)/)[0]; // some errors report line numbers and codeframes message = message.trim();