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

Run TypeScript tests in ts-node #197

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

Mr0grog
Copy link
Contributor

@Mr0grog Mr0grog commented Jan 26, 2024

We previously ran the test/type-test.ts test through the TypeScript compiler to catch type issues, but there are more subtle problems that can happen at runtime with tools like ts-node (and maybe things like Deno, too — I haven't tested that). This actually runs the test file in ts-node to make sure it doesn't throw at runtime, which would have caught issues like #196 ahead of time.

⚠️ This isn’t ready to merge. I added a commit that should cause the test to fail (partly reverting the fix for #196). If it fails, that I’ll take that back out and it should be merge-able.

We previously ran the `test/type-test.ts` test through the TypeScript compiler to catch type issues, but there are more subtle problems that can happen at runtime with tools like `ts-node` (and maybe things like Deno, too -- I haven't tested that). This additionally *runs* the test file to make sure it doesn't throw at runtime, which would have caught issues like pimterry#196 ahead of time.
Test that the new test in ts-node is actually working. This needs to be reverted before shipping.
@Mr0grog
Copy link
Contributor Author

Mr0grog commented Jan 26, 2024

Ah, beautiful failure! This prints out some pretty good info in the GitHub Actions logs:

Screenshot of logs from CI failure

@Mr0grog Mr0grog marked this pull request as ready for review January 26, 2024 01:07
@Mr0grog
Copy link
Contributor Author

Mr0grog commented Jan 26, 2024

✅ Should be safe to ship now!

@pimterry pimterry merged commit 52a80eb into pimterry:master Jan 26, 2024
11 checks passed
@pimterry
Copy link
Owner

Good idea, thanks!

@Mr0grog Mr0grog deleted the 196-better-ts-testing branch January 26, 2024 15:03
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.

None yet

2 participants