mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[test] Add pragma parsing to test runner
This commit is contained in:
@@ -33,10 +33,25 @@ wasmFolder(
|
||||
path.join(__dirname, "..", "..", "node_modules", "@hpcc-js", "wasm", "dist")
|
||||
);
|
||||
|
||||
const Pragma_RE = /\/\/\s*@enable\((\w+)\)$/gm;
|
||||
|
||||
describe("React Forget (HIR version)", () => {
|
||||
generateTestsFromFixtures(
|
||||
path.join(__dirname, "fixtures", "hir"),
|
||||
(input, file) => {
|
||||
const matches = input.matchAll(Pragma_RE);
|
||||
|
||||
for (const match of matches) {
|
||||
const [, key, value] = match;
|
||||
switch (key) {
|
||||
case "Pass":
|
||||
// do something with value;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`unknown pragma: ${key}`);
|
||||
}
|
||||
}
|
||||
|
||||
const ast = parser.parse(input, {
|
||||
sourceFilename: file,
|
||||
plugins: ["typescript", "jsx"],
|
||||
|
||||
Reference in New Issue
Block a user