-
Notifications
You must be signed in to change notification settings - Fork 69
chore(TS) Include .spec
files in tsconfig
#3076
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
Conversation
🦋 Changeset detectedLatest commit: 63d8c43 The changes in this PR will be included in the next version bump. This PR includes changesets to release 112 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Pull Request Overview
This PR updates TypeScript configuration files across the LeafyGreen UI monorepo to include .spec
files in the build process, ensuring that type tests are type-checked at build time. The change removes the "**/*.spec.*"
exclusion pattern from tsconfig.json
files across 100+ packages.
- Removes TypeScript exclusion of
.spec
files from all package configurations - Updates existing spec files to address newly surfaced TypeScript errors
- Adds missing dependencies and references to support spec file type checking
Reviewed Changes
Copilot reviewed 114 out of 115 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
Multiple tsconfig.json files |
Remove "**/*.spec.*" from exclude patterns to enable type checking of test files |
Various .spec.tsx files |
Fix TypeScript errors exposed by including spec files in compilation |
packages/hooks/package.json |
Add missing test renderer dependencies for spec file compilation |
packages/icon/tsconfig.json |
Include additional script files and add lib reference |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
@@ -100,7 +100,7 @@ describe('packages/icon-button', () => { | |||
}); | |||
|
|||
test('requires either aria-label or aria-labelledby', () => { | |||
/// @ts-expect-error | |||
// FIXME: // @ts-expect-error - aria-label or aria-labelledby is required |
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.
@@ -104,7 +104,7 @@ describe('packages/info-sprinkle', () => { | |||
// eslint-disable-next-line jest/no-disabled-tests | |||
test.skip('types behave as expected', () => { | |||
<> | |||
{/* @ts-expect-error - Missing children */} | |||
{/* FIXME: add expect error @ts-expect-error - Missing children */} |
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.
type AnchorLikeProps = InferredPolymorphicProps<'a', BaseLinkProps>; | ||
|
||
type LinkRenderProps = SpanLikeProps | AnchorLikeProps; | ||
type LinkRenderProps = InferredPolymorphicProps<'span', BaseLinkProps>; |
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.
Can we get away with this, because if href
is defined, the component props are set to a
element props, and span
is ignored?
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.
That's by design. If we define href
we want to use a
props not span
props
@@ -12,6 +12,8 @@ const addChartSeries = jest.fn(); | |||
const ChartProviderMock = ({ children }: PropsWithChildren<{}>) => { | |||
return ( | |||
<ChartContext.Provider | |||
// TODO: Fix this test context @tsck |
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.
👍 Will fix this once it's merged - https://jira.mongodb.org/browse/LG-5478
Size Change: -1 B (0%) Total Size: 2.01 MB
ℹ️ View Unchanged
|
Adding
.spec
files to the tsconfig ensures that any type tests get type checked at build-time.Updates spec files to resolve TS issues where the solution is simple.
Adds
FIXME
comments where types in spec files were already brokenNext steps: Type check spec & story files only on
test
run (not everybuild
)This will slow down builds somewhat in the short term