-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
fix(plugin-content-docs): fix error message context (error cause) when doc processing fails #8234
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of 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.
good start thanks 👍
Can you also please add a unit test somewhere so that we be sure it works and never stops working again?
Actually I'm not very familiar with writing tests 😅, If you could guide me I'll add it. Any links to similar tests would be appreciated |
You can get inspiration from: https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts#L684 Create a md file with the bad frontmatter that should get rejected, then run the fn in a test and assert that the correct error message was thrown. Run Actually I think some existing tests might cover the error message already, and will start failing with your fix because the message is now updated to something better: you may have to change the assertions/snapshots to reflect the change. I'm not sure how Jest plays well with Error Cause, may have to look into it myself later. Let me know if you don't find a solution. If you want to contribute to open-source it will be important to be able to write tests so it's worth you give it a try ;) |
This would be helpful to get started, thanks
😄Will definitely consider your advice and I'll give this a try 🚀 |
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.
Thanks 👍
Fixed the test to assert that we have the full error cause chain being tested
await
docMetaData and handle error…n doc processing fails (#8234) Co-authored-by: sebastienlorber <[email protected]>
Pre-flight checklist
Motivation
await
the promise fromdoProcessDocMetadata
and throw error if it failsTest links
Deploy preview: https://deploy-preview-8234--docusaurus-2.netlify.app/
Related issues/PRs
Resolves #8230
Suggested fix #8230 (comment)