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

Type check test files #971

Merged
merged 2 commits into from
Jan 20, 2021
Merged

Type check test files #971

merged 2 commits into from
Jan 20, 2021

Conversation

colebemis
Copy link
Contributor

@colebemis colebemis commented Jan 20, 2021

Problem

As part of the TypeScript refactor, we're rewriting component test files in TypeScript. However, we never type check these test files during CI. So test files with type errors could still pass CI and be merged into the main branch, causing errors in consuming applications.

For example, if the type definition for the Box component is incorrect, we might not know about the error until a consuming application uses Box and encounters the error. If we type check the Box test file during CI, we'd surface the error before merging the PR.

Solution

This PR updates tsconfig.json to include test files when type checking and generating type definition files.

Impact

If any test files contain type errors, CI will fail. Since our tests (should) resemble the way components are used, we can catch type errors before they reach consumers.

@vercel
Copy link

vercel bot commented Jan 20, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/3591cf9mc
✅ Preview: https://primer-components-git-colebemis-type-check-tests.primer.now.sh

@colebemis colebemis mentioned this pull request Jan 20, 2021
53 tasks
@vercel vercel bot temporarily deployed to Preview January 20, 2021 00:54 Inactive
@colebemis colebemis changed the title [WIP] Type check test files Type check test files Jan 20, 2021
@colebemis colebemis marked this pull request as ready for review January 20, 2021 04:50
Copy link
Contributor

@dmarcey dmarcey left a comment

Choose a reason for hiding this comment

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

Good catch - this is a great fix to make sure that we're typing properly in @primer/components before the new versions get into consumers' hands.

@colebemis colebemis merged commit 6b24527 into main Jan 20, 2021
@colebemis colebemis deleted the colebemis/type-check-tests branch October 29, 2021 00:45
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