-
Notifications
You must be signed in to change notification settings - Fork 187
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
Test componentToHints
, exclude test files from be published
#381
Conversation
|
@@ -59,7 +61,7 @@ const getTitle = (title: string | undefined) => { | |||
}; | |||
|
|||
export interface PlayroomProps { | |||
components: Record<string, ComponentType>; | |||
components: Record<string, ComponentType<any>>; |
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.
ComponentType
defaults to a component with no props, specifying any
here permits components with or without props, which is obviously more accurate than before.
@@ -3,9 +3,10 @@ import omit from 'lodash/omit'; | |||
import parsePropTypes from 'parse-prop-types'; | |||
import type { PlayroomProps } from '../Playroom/Playroom'; | |||
|
|||
const staticTypes = __PLAYROOM_GLOBAL__STATIC_TYPES__; |
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.
Moving this into Playroom.tsx
makes this function much easier to test as there's no need to modify globals in the tests.
*.test.* | ||
|
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.
Tested this with npm pack
:
Before: 128 files being packaged.
After: 124 files being packaged.
There are exactly 4 test files inside src
, so this seems correct.
I have a branch to remove
lodash
as a dep, which is used bycomponentToHints
, so I wanted to add some tests to ensure nothing breaks.Also noticed that test files are being published, so I've added a
.npmignore
to prevent that (while also renaming all.spec
tiles to.test
).