mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
[test] Add pragma parsing to test runner
This commit is contained in:
1 parent
5f81b7bc30
commit
e015bf6a7b
1 file changed
+15
@@ -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