mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
75fc20981a
The github action was exceeding maximum allowed memory size because we were no longer grouping messages correctly prior to formatting them in the script. I think these were introduced when we integrated the Babel plugin into the preprocessor. This PR strips out filenames from the message so they can be grouped together again. Also added some light comments Test plan: manually ran `scripts/test262.sh` and verified that the JSON was grouped together correctly
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
const BabelPluginReactForget = require("../dist/Babel/BabelPlugin").default;
|
|
const transformSync = require("@babel/core").transformSync;
|
|
|
|
// 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");
|
|
}
|
|
} 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
|
|
error.message = error.message.replace(/ \(\d+:\d+\)/, ""); // some errors report line numbers
|
|
error.message = error.message.replace(/\/.*\.js:\s/, ""); // babel seems to output filenames
|
|
test.result = {
|
|
stderr: `${error.name}: ${error.message}\n`,
|
|
stdout: "",
|
|
error,
|
|
};
|
|
}
|
|
|
|
return test;
|
|
};
|