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
Run parser tests from the official TypeScript parser #10444
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11582/ |
@nicolo-ribaudo Regarding the whitelist file. There are plenty of cases where the Babel TS parser doesn't fail / pass as it should which isn't related to the type checker.. Just to mention a few ... The current dynamic import isn't equal to what TS does, the subtract type node should also accept I think I discovered around 60 different cases in total. |
Yeah I know, but a significant part of them are for things like duplicate declarations, or invalid modifiers (e.g. |
Makefile
Outdated
test-typescript: | ||
node scripts/tests/typescript | ||
|
||
test-typescript-ci: bootstrap test-typescript |
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.
It will fail on make -j test-typescript-ci
since test-typescript
depends on bootstrap
. Could you rebase on master?
scripts/tests/typescript/index.js
Outdated
const names = await fs.readdir(dir); | ||
|
||
for (const name of names) { | ||
//if (name !== "abstractProperty.ts") continue; |
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.
nit: code-like comments should be removed.
75e6196
to
79fe856
Compare
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.
Great work!
ae2b24a
to
99ea52e
Compare
99ea52e
to
6437313
Compare
The two commits can/should be reviewed one by one.
In the first commit, I abstracted the logic to run external Babel tests: I now that abstractions can introduce bugs, but I didn't want to have three different files to do basically the same thing 😛
In the second commit I added the tests from https://github.com/Microsoft/TypeScript. The whitelist is so big because many invalid JavaScript programs are accepted by the TypeScript parser without any error (because they report them in the typechecker, which is too strict compared to
@babel/parser
).cc @babel/typescript