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

Add test case for sub components (demonstrates invalid syntax in output) #60

Closed
wants to merge 10 commits into from
Closed

Add test case for sub components (demonstrates invalid syntax in output) #60

wants to merge 10 commits into from

Conversation

stevenpetryk
Copy link

@stevenpetryk stevenpetryk commented Jan 28, 2022

This PR is meant to demonstrate/add a test case for the invalid output described in #57. It stems from a bug in react-docgen-typescript where components that are assigned to properties of other components are given a name of default.Name.

The snapshot that gets generated by the test suite for this (valid) file contains a syntax error.

pull_request:
branches:
- master
- main
- next
Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I think I cloned Storybook's fork of this project. Some of these changes are unrelated. But check out the snapshot below :)

Comment on lines +234 to +236
default.Sub.displayName = \\"default.Sub\\";
// @ts-ignore
default.Sub.__docgenInfo = { \\"description\\": \\"\\", \\"displayName\\": \\"default.Sub\\", \\"props\\": { \\"name\\": { \\"defaultValue\\": null, \\"description\\": \\"\\", \\"name\\": \\"name\\", \\"required\\": true, \\"type\\": { \\"name\\": \\"string\\" } } } };
Copy link
Author

Choose a reason for hiding this comment

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

Syntax errors here (so even the defensive try/catch doesn't help :(

@@ -143,6 +143,18 @@ export default class DocgenPlugin implements webpack.WebpackPluginInstance {
}
Copy link
Author

Choose a reason for hiding this comment

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

Irrelevant file, sorry again!

@stevenpetryk
Copy link
Author

Just gonna close this, too messy. Fixing my fork.

@stevenpetryk stevenpetryk deleted the sub-component-error-repro branch January 28, 2022 01:14
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