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

Test componentToHints, exclude test files from be published #381

Merged
merged 5 commits into from
Dec 10, 2024

Conversation

askoufis
Copy link
Contributor

@askoufis askoufis commented Dec 10, 2024

I have a branch to remove lodash as a dep, which is used by componentToHints, 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).

@askoufis askoufis requested a review from a team as a code owner December 10, 2024 03:13
Copy link

changeset-bot bot commented Dec 10, 2024

⚠️ No Changeset found

Latest commit: 2c8bb73

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -59,7 +61,7 @@ const getTitle = (title: string | undefined) => {
};

export interface PlayroomProps {
components: Record<string, ComponentType>;
components: Record<string, ComponentType<any>>;
Copy link
Contributor Author

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__;
Copy link
Contributor Author

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.

Comment on lines +1 to +2
*.test.*

Copy link
Contributor Author

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.

@askoufis askoufis merged commit 51d14d3 into master Dec 10, 2024
6 checks passed
@askoufis askoufis deleted the test-component-to-hints branch December 10, 2024 04:49
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