[ez] Update test262-preprocessor to use the same config as hir-test
Lauren Tan committed
Jan 19, 2023 at 11:37 UTC
40df4a8a86daaef373971b53761019c1cefc6d1c
1 file changed
+3
-12
compiler/forget/scripts/test262-preprocessor.js
+3
-12
@@ -1,24 +1,15 @@
1
-const BabelPluginReactForget = require("../dist/Babel/BabelPlugin").default;
2
-const transformSync = require("@babel/core").transformSync;
1
+const runReactForgetBabelPlugin = require("../dist/Babel/RunReactForgetBabelPlugin");
2
3
// Preprocessor that runs Forget on the test262 test prior to execution. Compilation errors short
4
// circuit test execution and report an error immediately.
5
module.exports = (test) => {
6
try {
8
- const generated = transformSync(test.contents, {
9
- filename: test.file,
10
- plugins: [BabelPluginReactForget],
11
- });
12
- if (generated.code != null && generated.code !== "") {
13
- test.contents = generated.code;
14
- } else {
15
- throw new Error("Codegen returned an empty string");
16
- }
7
+ test.contents = runReactForgetBabelPlugin(test.contents, test.file).code;
8
} catch (error) {
9
// We use the `stderr` output to group errors so we can count them, so we need to dedupe errors
10
// that are the same but differ slightly.
11
let { name, message } = error;
21
- message = message.replace(/\/.*\.js:\s/, ""); // babel seems to output filenames
12
+ message = message.replace(/^\/.*?:\s/, ""); // babel seems to output filenames
13
message = message.split(/\(\d+:\d+\)/)[0]; // some errors report line numbers and codeframes
14
message = message.trim();
15