Skip to content
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

Reduce false negative cases of typescript parser tests #10979

Merged

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jan 10, 2020

Q                       A
Fixed Issues? Reduced the false positive cases of parser-typescript-tests
License MIT

For details please refer to the comment section of new files.

I have commented out the error codes which would introduce new false positive cases, so that this PR is only removing the false negative cases.

Before

 ✔ 4293 valid programs parsed without error
 ✔ 277 invalid programs produced a parsing error
 ✔ 4 invalid programs did not produce a parsing error (and allowed by the whitelist file)
 ✔ 505 valid programs produced a parsing error (and allowed by the whitelist file)

After

 ✔ 4293 valid programs parsed without error
 ✔ 388 invalid programs produced a parsing error
 ✔ 4 invalid programs did not produce a parsing error (and allowed by the whitelist file)
 ✔ 395 valid programs produced a parsing error (and allowed by the whitelist file)

When reading the TypeScript tests, I realize that some false negative cases comes from that we are not running test properly. i.e. declarationMapsOutFile.ts uses @filename annotation to specify multiple typescript files inside a single testcase. But we are parsing the whole testcase a single file, this would introduce FN especially if the case is testing import/exports. That's why we have many import/export related case in the whitelists. I would address this issue in a separate PR.

@JLHwung JLHwung added the PR: Internal 🏠 A type of pull request used for our changelog categories label Jan 10, 2020
@@ -1,7 +1,8 @@
const path = require("path");
const fs = require("fs").promises;
const ts = require("typescript");
const ts = require("../../../build/typescript");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the bundled typescript bin since the dev dependency could be out-of-dated.


module.exports = [
// "TS1005", // '{0}' expected.
"TS1009", // Trailing comma not allowed.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript does not push parseDiagnostics for all and not limited to these errors. 🤷

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nicolo-ribaudo nicolo-ribaudo merged commit 9fec528 into babel:master Jan 10, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the reduce-typescript-test-false-negative branch January 10, 2020 21:11
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Apr 11, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants