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

Improve type testing for older versions of TypeScript #254

Merged
merged 4 commits into from
Nov 1, 2021

Conversation

christopher-stripe
Copy link
Contributor

@christopher-stripe christopher-stripe commented Oct 27, 2021

Our intent is to support TypeScript versions >= 3.1 with the types in this repository, but we don't have robust automated tests to ensure that new types we add work on older versions of TypeScript.

We have reasonably thorough tests for our types in tests/types/index.ts, but they only run through a single TypeScript compiler version. We have separate tests in tests/versions that run through many different TypeScript compiler versions, but they aren't thorough at all.

This PR deletes the tests/versions types, and changes the tests/types tests to run through many different versions of TypeScript using a script.

To achieve this, I needed to split up the tests that use // @ts-expect-error into a separate file. This feature is only supported on TypeScript >= 3.9, so we don't run those tests on older TypeScript versions with the new set up.

@@ -0,0 +1,44 @@
#!/usr/bin/env zx
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I lost patience when trying to compare two version strings in bash and added zx as a dep. I think this will help future contributors that want to modify this script, as we are all much more comfortable with JavaScript vs. bash.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, bash is write-only for me. I am not familiar with zx but it is already more readable.

rado-stripe
rado-stripe previously approved these changes Oct 30, 2021
Copy link
Contributor

@rado-stripe rado-stripe left a comment

Choose a reason for hiding this comment

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

Looks great!

tests/types/scripts/test.mjs Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants