GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: print instruction for creating missing snapshot in assertSnapshot by rluvaton · Pull Request #48914 · nodejs/node

Conversation

@rluvaton

@rluvaton rluvaton commented Jul 25, 2023

Copy link
Copy Markdown
Member

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure. labels Jul 25, 2023
@rluvaton rluvaton changed the title when snapshot is missing print how to generate one test: when snapshot is missing print how to generate one Jul 25, 2023
@rluvaton
rluvaton force-pushed the log-helpful-message-when-missing-snapshot branch from a47acde to 699f9c2 Compare July 25, 2023 08:32
MoLow
MoLow reviewed Jul 25, 2023
View reviewed changes
Comment thread test/common/assertSnapshot.js Outdated
Comment on lines 42 to 44

@MoLow MoLow Jul 25, 2023

Copy link
Copy Markdown
Member

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.

Suggested change
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;

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rluvaton rluvaton Jul 25, 2023

Copy link
Copy Markdown
Member Author

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...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@MoLow MoLow changed the title test: when snapshot is missing print how to generate one test: generate snapshot if it is missing Jul 25, 2023
MoLow
MoLow approved these changes Jul 25, 2023
View reviewed changes
tniessen
tniessen reviewed Jul 25, 2023
View reviewed changes

@tniessen tniessen left a comment

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig reacted with thumbs up emoji MoLow reacted with eyes emoji
All reactions
  • 👍 1 reaction
  • 👀 1 reaction
@rluvaton

rluvaton commented Jul 25, 2023

Copy link
Copy Markdown
Member Author

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MoLow

MoLow commented Jul 25, 2023

Copy link
Copy Markdown
Member

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?
I don't view this as something super important, and I don't want to over complicate - so I am also ok with the original approach of only printing a message if this becomes to complicated

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tniessen

tniessen commented Jul 25, 2023

Copy link
Copy Markdown
Member

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.

MoLow reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rluvaton

rluvaton commented Jul 25, 2023

Copy link
Copy Markdown
Member Author

I think it will overly complicate, reverting to use the log

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MoLow
MoLow approved these changes Jul 25, 2023
View reviewed changes
@tniessen

tniessen commented Jul 25, 2023

Copy link
Copy Markdown
Member

(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.)

MoLow reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rluvaton
rluvaton force-pushed the log-helpful-message-when-missing-snapshot branch 2 times, most recently from 1a0b3b2 to f6cd240 Compare July 26, 2023 14:43
@rluvaton

rluvaton commented Jul 26, 2023

Copy link
Copy Markdown
Member Author

@tniessen updated :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tniessen

tniessen commented Jul 26, 2023

Copy link
Copy Markdown
Member

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 :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rluvaton
rluvaton force-pushed the log-helpful-message-when-missing-snapshot branch from f6cd240 to 8af0b1f Compare July 26, 2023 15:44
@rluvaton
test: print instruction for creating missing snapshot in assertSnapshot
ef9dae5
@rluvaton
rluvaton force-pushed the log-helpful-message-when-missing-snapshot branch from 8af0b1f to ef9dae5 Compare July 26, 2023 15:46
@rluvaton

rluvaton commented Jul 26, 2023

Copy link
Copy Markdown
Member Author

updated, if it can be improved I would appreciate what commit message would you write

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rluvaton

rluvaton commented Jul 26, 2023

Copy link
Copy Markdown
Member Author

Coverage for some reason failed even thought I did not changed any source file not removed test files

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tniessen tniessen changed the title test: generate snapshot if it is missing test: print instruction for creating missing snapshot in assertSnapshot Jul 27, 2023
@debadree25 debadree25 added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jul 31, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jul 31, 2023
@nodejs-github-bot

nodejs-github-bot commented Jul 31, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/53011/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Aug 1, 2023
CI Reliability 2023-08-01 nodejs/reliability#630
Open
CI Reliability 2023-08-02 nodejs/reliability#631
Open
CI Reliability 2023-08-03 nodejs/reliability#632
Open
@github-actions github-actions Bot mentioned this pull request Aug 4, 2023
CI Reliability 2023-08-04 nodejs/reliability#633
Open
25 tasks
@rluvaton

rluvaton commented Aug 9, 2023

Copy link
Copy Markdown
Member Author

Can we please add the request-ci label?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

benjamingr
benjamingr approved these changes Aug 9, 2023
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented Aug 10, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/53131/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Aug 11, 2023
CI Reliability 2023-08-11 nodejs/reliability#634
Open
1 of 29 tasks
@nodejs-github-bot

nodejs-github-bot commented Aug 11, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/53174/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MoLow MoLow added the commit-queue PRs queued for automated landing through the Commit Queue. label Aug 11, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Aug 11, 2023
@nodejs-github-bot
nodejs-github-bot merged commit dadbdaf into nodejs:main Aug 11, 2023
@nodejs-github-bot

nodejs-github-bot commented Aug 11, 2023

Copy link
Copy Markdown
Collaborator

Landed in dadbdaf

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rluvaton
rluvaton deleted the log-helpful-message-when-missing-snapshot branch August 11, 2023 08:48
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@rluvaton @Ceres6
test: print instruction for creating missing snapshot in assertSnapshot
f8e1ac3
PR-URL: nodejs#48914
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@rluvaton @Ceres6
test: print instruction for creating missing snapshot in assertSnapshot
0697014
PR-URL: nodejs#48914
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Aug 15, 2023
@rluvaton @RafaelGSS
test: print instruction for creating missing snapshot in assertSnapshot
3c4e98c
PR-URL: #48914
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@UlisesGascon UlisesGascon mentioned this pull request Aug 15, 2023
v20.6.0 proposal #49185
Merged
RafaelGSS pushed a commit to RafaelGSS/node that referenced this pull request Aug 15, 2023
@rluvaton @RafaelGSS
test: print instruction for creating missing snapshot in assertSnapshot
398bb44
PR-URL: nodejs#48914
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Aug 17, 2023
@rluvaton @RafaelGSS
test: print instruction for creating missing snapshot in assertSnapshot
e70e974
PR-URL: #48914
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit that referenced this pull request Nov 27, 2023
@rluvaton @targos
test: print instruction for creating missing snapshot in assertSnapshot
a2ca1a6
PR-URL: #48914
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@targos targos mentioned this pull request Nov 28, 2023
v18.19.0 release proposal #50953
Merged
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
test: print instruction for creating missing snapshot in
83dcbb7
PR-URL: nodejs/node#48914
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
test: print instruction for creating missing snapshot in
cf95e5f
PR-URL: nodejs/node#48914
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tniessen tniessen tniessen left review comments
@benjamingr benjamingr benjamingr approved these changes
@MoLow MoLow MoLow approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@rluvaton @MoLow @tniessen @nodejs-github-bot @benjamingr @debadree25
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.