-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
doc,test: improvements and cleanup for assert.snapshot() #44429
Conversation
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 for this
we can add |
I don't think we should add a |
Luckily, Other things that surprise me:
I really think we should put a focus on correctness instead of rapidly adding new APIs (even if experimental). |
@@ -1512,7 +1512,7 @@ loading phase, it will always raise it as an uncaught exception. | |||
added: v18.8.0 | |||
--> | |||
|
|||
Force updating snapshot files for [`assert.snapshot()`][] | |||
Updates snapshot files used by [`assert.snapshot()`][]. |
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 should probably be marked as experimental.
Also, adding to my previous comment, the documentation of
This seems contradictory to |
@tniessen I think it's worth opening one or more separate issues with the details you've outlined here - particularly the required contract change to Just don't add the tsc-agenda label yet so that we can hopefully avoid meeting this week 😄 |
I think we generally just missed this in the original PR and hadn't considered the point you're making here and I think that after I've read your point it I agree with you. We should absolutely change the serialization to not always use The fact the feature is tricky doesn't mean (IMO) we shouldn't add it and if the trickiness causes changes and iterations that's totally a good thing IMO.
That can also be revisited. As a side note, while the feedback on the feature is very valuable I would like you to consider giving such feedback (if possible) during the PR lifecycle. The original PR was open for more than a week for feedback (and if you need more time to review - it's totally fine to "request changes" and ask). During that week multiple iterations incorporating feedback were performed. It's frustrating to have to do (or even just review) duplicate work so the earlier the feedback is - the better (not even considering the userland impact). |
imo trickiness should mean, though, that nothing gets added before the design space is thoroughly explored. @benjamingr that feedback was explicitly provided ( #44095 (review) ): but this project has a strong bias to merge PRs. |
I generally agree that
why not? do you think we should change |
I disagree with that assertion. I think experimenting is a great way to nail down the API and experimental APIs are a good way to prototype with new features and figure out the design space. Being allowed to not get it perfect the first time and iterate is a really important property IMO.
Are you sure you linked to the right comment? The one you linked to just says it's tricky and mentions recursion - it doesn't bring up Tobias's point about
I sure hope it does - though if we stopped and tried figuring out how to do things perfect the first time nothing would land and we still wouldn't have had a test runner. I understand "let's not land stuff that isn't 100% ready" is a valid perspective - it's just not one I share about the project. |
While I don't think a slippery slope argument is valid, it's not on topic for this PR, so I won't debate it :-) you're right that my linked comment doesn't mention |
Yea, I think it should just be a single synchronous method. This is just my opinion, and others might disagree, but my reasoning is:
Looking at a few implementations of snapshot testing, it looks like there are sync and async implementations in the wild, so this is not a hill I will die on. I'm also much happier having async snapshot testing than no snapshot testing at all. |
Commit Queue failed- Loading data for nodejs/node/pull/44429 ✔ Done loading data for nodejs/node/pull/44429 ----------------------------------- PR info ------------------------------------ Title doc,test: improvements and cleanup for assert.snapshot() (#44429) Author Colin Ihrig (@cjihrig) Branch cjihrig:cleanup -> nodejs:main Labels assert, author ready Commits 3 - doc: improve assert.snapshot() docs - test: style updates for assert.snapshot() - doc: add --update-assert-snapshot to node.1 Committers 1 - cjihrig PR-URL: https://github.com/nodejs/node/pull/44429 Reviewed-By: Moshe Atlow Reviewed-By: Benjamin Gruenbaum ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/44429 Reviewed-By: Moshe Atlow Reviewed-By: Benjamin Gruenbaum -------------------------------------------------------------------------------- ℹ This PR was created on Sun, 28 Aug 2022 19:33:19 GMT ✔ Approvals: 2 ✔ - Moshe Atlow (@MoLow): https://github.com/nodejs/node/pull/44429#pullrequestreview-1087905122 ✔ - Benjamin Gruenbaum (@benjamingr): https://github.com/nodejs/node/pull/44429#pullrequestreview-1089275817 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2022-08-31T01:26:04Z: https://ci.nodejs.org/job/node-test-pull-request/46332/ - Querying data for job/node-test-pull-request/46332/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD ✔ origin/main is now up-to-date - Downloading patch for 44429 From https://github.com/nodejs/node * branch refs/pull/44429/merge -> FETCH_HEAD ✔ Fetched commits as 4d8674b50f60..11c0ecd7965e -------------------------------------------------------------------------------- [main bdfac40055] doc: improve assert.snapshot() docs Author: cjihrig Date: Sun Aug 28 14:59:28 2022 -0400 2 files changed, 29 insertions(+), 13 deletions(-) [main 4415adaf6d] test: style updates for assert.snapshot() Author: cjihrig Date: Sun Aug 28 15:02:52 2022 -0400 5 files changed, 7 insertions(+), 7 deletions(-) [main aaade5c256] doc: add --update-assert-snapshot to node.1 Author: cjihrig Date: Sun Aug 28 15:26:33 2022 -0400 1 file changed, 3 insertions(+) ✔ Patches applied There are 3 commits in the PR. Attempting autorebase. Rebasing (2/6)https://github.com/nodejs/node/actions/runs/2960763125 |
@benjamingr I try to give feedback on as many PRs as possible, but I simply don't have the time or energy to look at every single PR. I agree though, at least some of these problems should have been brought up during review. The multiple problems with the implementation and design that I mentioned here are not my personal opinion; they could have been brought up by others during the original review cycle just as well. Those who approve a PR take at least partial responsibility for its quality. @cjihrig You need to add either |
PR-URL: nodejs#44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
This commit updates the assert.snapshot() fixtures to better match the code style of the rest of the codebase. PR-URL: nodejs#44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
PR-URL: nodejs#44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
PR-URL: #44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
This commit updates the assert.snapshot() fixtures to better match the code style of the rest of the codebase. PR-URL: #44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
PR-URL: #44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
PR-URL: #44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
This commit updates the assert.snapshot() fixtures to better match the code style of the rest of the codebase. PR-URL: #44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
PR-URL: #44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
PR-URL: #44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
This commit updates the assert.snapshot() fixtures to better match the code style of the rest of the codebase. PR-URL: #44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
PR-URL: #44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
PR-URL: nodejs#44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
This commit updates the assert.snapshot() fixtures to better match the code style of the rest of the codebase. PR-URL: nodejs#44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
PR-URL: nodejs#44429 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
The |
General improvements and cleanup of the docs and tests recently added for
assert.snapshot()
.Side note: it feels pretty unfortunate that
assert.snapshot()
returns aPromise
, but that is not changed here.