-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Migrating third-party parser tests to MakeJS #15431
Conversation
liuxingbaoyu
commented
Feb 16, 2023
•
edited by gitpod-io
bot
edited by gitpod-io
bot
Q | A |
---|---|
License | MIT |
Makefile.source.mjs
Outdated
@@ -389,6 +389,73 @@ target["test-cov"] = function () { | |||
); | |||
}; | |||
|
|||
function getParserTestsCommit(id) { | |||
const content = readFileSync("./Makefile", "utf8"); | |||
const commit = content.match(new RegExp(`${id}_COMMIT = (\\w{40})`))[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need to store these commits in Makefile
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to keep them so that we don't need to regenerate Makefile.js
.
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/53935/ |
Makefile.source.mjs
Outdated
const dir = "./build/flow"; | ||
|
||
shell.rm("-rf", dir); | ||
shell.mkdir("-p", "build"); | ||
|
||
exec("git", [ | ||
"clone", | ||
"--filter=blob:none", | ||
"--sparse", | ||
"--single-branch", | ||
"--shallow-since=2021-05-01", | ||
"https://github.com/facebook/flow.git", | ||
dir, | ||
]); | ||
|
||
exec("git", ["sparse-checkout", "set", "src/parser/test/flow"], dir); | ||
exec("git", ["checkout", "-q", getParserTestsCommit("FLOW")], dir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the contents of these three commands is almost the same, could we extract them to a bootstrapParserTests(dir, repoURL, repoDir, commit)
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ignored the --shallow-since
difference, it doesn't matter.
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>