-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: Add snapshot test for changelog formatting #34049
Conversation
Size Change: 0 B Total Size: 1.03 MB ℹ️ View Unchanged
|
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.
This is looking good and a great example of when using snapshots is actually helpful.
My only concern was whether you'd modified any of the code that builds the changelog as we're making quite a few changes in various PRs that are about to be merged into trunk
.
I wonder - by extracting the formatChangelog
will you have lost some changes that have been merged into trunk
since this PR was created? I noticed some inconsistencies so it makes me think that yes this will be the case.
I think (if you aren't already planning to do so) it would be good to copy/paste the changelog code from trunk
into your formatChangelog
once #34042 has been merged. That will ensure everything is up to date and we don't lose any changes.
Thanks again for adding tests 🥇
To be clear you should expect to see:
|
048810e
to
7dc5d34
Compare
7dc5d34 - it looks like all the changes are applied correctly now. The diff in the snapshot is very simple to process and gives instant confirmation that the output looks as expected. |
Looks good to go 🚢 |
Description
A follow-up to my comment #34042 (comment):
The idea is very simple. I executed:
npm run changelog -- --milestone="Gutenberg 11.3"
and saved the result from
fetchAllPullRequests
call as JSON.I extracted all processing logic to
formatChangelog
function. The test uses the saved fixture (quite large) to verify the generated output string using the stored snapshot that should be good enough for visual verification.How has this been tested?
Screenshots
Despite the huge size of the fixture with the response from GitHub it seems to be pretty fast.
Types of changes
New test.
Checklist:
*.native.js
files for terms that need renaming or removal).