-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: print instruction for creating missing snapshot in assertSnapshot #48914
test: print instruction for creating missing snapshot in assertSnapshot #48914
Conversation
a47acde
to
699f9c2
Compare
console.log( | ||
'Snapshot file does not exist. You can create a new one by running the test with NODE_REGENERATE_SNAPSHOTS=1', | ||
); |
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.
console.log( | |
'Snapshot file does not exist. You can create a new one by running the test with NODE_REGENERATE_SNAPSHOTS=1', | |
); | |
await fs.writeFile(snapshot, actual); | |
return; |
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.
I was on the fence about it...
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.
I don't have a strong opinion on this and I realize that the suggestion came from the author of this file, but implicitly and unpromptedly writing to a source directory during a regular test run seems like a footgun to me. For example, if the snapshot file is excluded by some accidental .gitignore
rule, this approach will silently create a new snapshot file in every repository checkout.
this is a good point, @MoLow what do you say? |
Maybe we can create the file if stdin is a tty - indicating this is a personal computer and the test is not run via the Python test runner, otherwise, print the original message. @tniessen WDYT? |
As I said, no strong opinion. My understanding is that this will only benefit folks who add new snapshot tests to node core, which seems like a very small group. |
I think it will overly complicate, reverting to use the log |
(On a side note, the commit message must be amended before landing. It is neither up-to-date nor does it comply with the commit message guidelines.) |
1a0b3b2
to
f6cd240
Compare
@tniessen updated :) |
FWIW it still doesn't comply with the commit guidelines. Most importantly, it doesn't begin with an imperative verb after the prefix. In the end, the person merging this PR will be responsible for checking/this this :) |
f6cd240
to
8af0b1f
Compare
8af0b1f
to
ef9dae5
Compare
updated, if it can be improved I would appreciate what commit message would you write |
Coverage for some reason failed even thought I did not changed any source file not removed test files |
Can we please add the |
Landed in dadbdaf |
PR-URL: nodejs#48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: nodejs#48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: nodejs#48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: nodejs#48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: nodejs#48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: nodejs/node#48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: nodejs/node#48914 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
No description provided.