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(react): add snapshot test for public API #5495

Conversation

joshblack
Copy link
Contributor

Adds in a test that snapshots our public API for carbon-components-react. In particular, this test uses our src/index.js entrypoint to determine which components we export and defines their public API through a combination of the components' propTypes and other properties available. To get prop type information, we mock the prop-types package to return the type information.

Changelog

New

  • Add a PublicAPI-test.js file that determines the public API of our components and creates a snapshot of these values

Changed

Removed

Testing / Reviewing

  • Verify the public API snapshot isn't crazy 😅

@joshblack joshblack requested a review from a team as a code owner March 1, 2020 04:47
@ghost ghost requested review from abbeyhrt and tw15egan March 1, 2020 04:47
@netlify
Copy link

netlify bot commented Mar 1, 2020

Deploy preview for carbon-elements ready!

Built with commit da6e180

https://deploy-preview-5495--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Mar 1, 2020

Deploy preview for carbon-components-react ready!

Built with commit da6e180

https://deploy-preview-5495--carbon-components-react.netlify.com

Copy link
Contributor

@abbeyhrt abbeyhrt left a comment

Choose a reason for hiding this comment

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

This looks good to me! Out of curiosity, would this slow anything down? Like our build time or something?

@joshblack
Copy link
Contributor Author

@abbeyhrt nope! Should only be an extra test 😄

Copy link
Collaborator

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

I'm all for it 👍 Changes made to PropTypes should be intentional, and this is a nice way to catch any unintended changes

CODEOWNERS Outdated Show resolved Hide resolved
@joshblack joshblack merged commit 2e38570 into carbon-design-system:master Mar 3, 2020
@joshblack joshblack deleted the chore/add-public-api-test-to-react branch March 3, 2020 21:23
joshblack added a commit to joshblack/carbon that referenced this pull request Mar 10, 2020
)

* test(react): add snapshot test for public API

* Update packages/react/__tests__/PublicAPI-test.js

* chore(project): update CODEOWNERS to include release team

* chore(react): update snapshot

* Update CODEOWNERS

Co-authored-by: TJ Egan <[email protected]>
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.

3 participants