-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: migrate test runner message tests to snapshot #47392
Conversation
CC @GeoffreyBooth @nodejs/test_runner |
cd45963
to
1c28b68
Compare
@MoLow Thank you for doing this! This is much more robust than I was envisioning. On quick skim, it seems like this takes care not only of my concern about moving the regex comparison into JavaScript and out of Python, but it also automates the snapshot generation? One thing I had to deal with with the |
@@ -134,7 +134,6 @@ | |||
|
|||
# Test runner | |||
|
|||
/test/message/test_runner_* @nodejs/test_runner | |||
/test/parallel/test-runner-* @nodejs/test_runner |
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.
Not in this PR, but perhaps we should move all the test runner stuff into /test/test-runner
?
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'm +0 on that
correct
this PR uses a transformer function replacing anything detected as a stack trace with an asterisk |
669aa40
to
cada058
Compare
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.
There's already a snapshot.js
file in test/common
, and the file name snap.js
does not really help distinguish between the two. Maybe just put these new functions into test/common/fixtures.js
? All the actual snapshots are stored in test/fixtures
anyway, as far as I can tell, so that seems appropriate.
@@ -181,7 +181,7 @@ not ok 4 - beforeEach throws | |||
* | |||
* | |||
* | |||
* | |||
async Promise.all (index 0) |
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.
Sorry, I don't really know what the test runner is doing. But why does this particular stack frame exist now? What's going on here?
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 diff is here since previously the .out
files where generated manually, and now they are generated automatically.
so stack trace lines are detected using a regex and replaced with *
.
these specific lines are not detected as stack trace lines and thus are not replaces which is ok (since what usually should be ignored is file paths and location in the file etc)
eef9e86
to
346ce00
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
PR-URL: nodejs#47392 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
8daec45
to
57508fb
Compare
Landed in 57508fb |
PR-URL: #47392 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #47392 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: nodejs#47392 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Ref: #47370 (comment)
this PR introduces an internal tool for snapshot testing.
today we use python for that and regenerate snapshots manually.
this is not a full-blown snapshot testing solution and has a few limitations that can be resolved/improved in the future if we have any more use cases or if we want to re-introduce
assert.snapshot
: