-
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: migrated test/message to JS fixture tests #47868
base: main
Are you sure you want to change the base?
test: migrated test/message to JS fixture tests #47868
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.
- please remove the changed zlib file inside dpes
- nothing requires these added fixtures. a test file must execute them using
common.assertSnapshot
- see https://github.com/nodejs/node/blob/bd913bee367e1ecd308bb7a3e5f6869813add31e/test/parallel/test-node-output-console.mjs and the other tests added in test: migrate message tests to use assertSnapshot #47498
Hi @MoLow, As requested, I reverted the changes to the zlib files and added the test runner files in the /parallel directory.
Additionally, I modified the test-node-output-console.mjs and test-node-output-errors.mjs to run some of the tests there. Of course, I made sure that the .snapshot files are congruent with the test output and all test succeed. I was, however, unable to figure out how to make the test util-inspect-error-cause.js evaluate correctly with the snapshot since the output seems to have some special characters that don't play well with RegEx. Here's an example: `My attempts to turn the following:
into:
where not successful.` This is the RegEx I was using: ` console.log(outputString); I would appreciate the input and help. Thanks! |
I don't know what should be the prefix of the test file names, but |
I totally agree, but I couldn't figure out a clear pattern or methodology for naming all these diverse tests. Open to suggestions. Thanks @targos! |
perhaps test-output , or test-message or test-snapshot? |
@MoLow Test runner name prefix changed to test-output. Let me know of any other observations. Thanks! |
see comment: https://github.com/nodejs/node/pull/47868/files#r1187744266 |
test/message/core_line_numbers.out
Outdated
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.
please revert all deleted files
this PR will need to be squashed / remove all merge commits |
Apologies @MoLow but I am not versed enough in git to figure out how to squash the commits when there's a merge in between. Could anybody help me here? Appreciate the help and I'm sorry for my ignorance. Thanks! |
You would probably want to: git fetch upstream main
git rebase upstream/main
git reset --soft upstream/main
git add .
git commit -m "test: migrate message tests to js fixtures" |
@MoLow I ran the commands and merged the changes. I don't believe the squashing of the commits was achieved tho. I'm struggling to figure this out. I'm holding back this PR with my lack of experience with git. |
Should I discard this PR and create a new one with only the changes in one commit? |
either that, or squash this PR into a commit with no merge commits, and no conflicts |
33591bb
to
555b9fc
Compare
test: migrate message tests to js fixtures squashed Add test runners to /parallel dir and fix snapshot Update test/parallel/test-node-output-tick.mjs Co-authored-by: Moshe Atlow <[email protected]> Update test/parallel/test-node-output-promise.mjs Co-authored-by: Moshe Atlow <[email protected]> Update test/parallel/test-node-output-assertion.mjs Co-authored-by: Moshe Atlow <[email protected]> Update test/parallel/test-node-output-map.mjs Co-authored-by: Moshe Atlow <[email protected]> fixed snapshot discrepancy with output-errors.mjs Corrected test runner name prefix Removing snapshots that show as 'new' on git diff Restored deleted files Deleted files restored
555b9fc
to
2df37de
Compare
Figured out how to properly squash the PR commits. Apologies for the hassle. |
@MoLow let me know of any other observations. Thanks! |
@@ -0,0 +1,10 @@ | |||
node:punycode:* |
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.
@projectnoa there are still many files that do not appear as moved
Hi @MoLow, Could you please provide some guidance? I really appreciate your help. Thanks! |
Sure, you should go over the diff of this PR and undo any changes to files that are not marked as moved |
@MoLow |
if it brakes tests, lets revert that as well. |
So, if I understand correctly.
Is this correct @MoLow ? |
I don't think having the original content is a must. I only asked the diff to be small enough for git to detect it as a file rename
for this phase, yes - then we can iterate in smaller PR's that can be reviewed more carfully
correct. they also do not have to be mjs files, that was just done for convenience |
Hello @MoLow, @NiharPhansalkar, I did my best to restore the .snapshots to their original state so they show as Edited and not New. Additionally, I restored the original Python tests in the message directory. I was unable to make the following test pass (stdin_messages.js, eval_messages.js, core_line_numbers.js, util-inspect-error-cause.js) since the contents of some of the .out files is just too different to the output produced by the tests. In the end I was just bending over backwards to twist the code to validate the test, which defeats the purpose of tests. If anybody is smart enough to figure where I went wrong and want to fix this PR, please do so. Otherwise, this is where I end my journey with this contribution, for my sanity's sake. I apologize for not being able to figure this out and make a proper contribution. Feel free to discard this PR if the effort of fixing it is not worth it. Thanks |
I don't think we should make the tests reduce the diff. just ship a first PR where all diffs are minimal, excluding tests that are more complicated. then in follow-up PRS - we can handle those tests with a bigger diff |
require('../../common'); | ||
require('../source-map/uglify-throw'); | ||
require('../common'); | ||
require('../fixtures/source-map/uglify-throw'); |
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 think in general we want all files to end with a newline.
|
||
Node.js * | ||
Node.js * |
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.
Why are all these files not ending with newlines? Aren’t they autogenerated?
at new Script (node:vm:*:*) | ||
at createScript (node:vm:*:*) | ||
at Object.runInThisContext (node:vm:*:*) | ||
at node:internal/process/execution:*:* | ||
at [eval]-wrapper:*:* | ||
at runScript (node:internal/process/execution:*:*) | ||
at evalScript (node:internal/process/execution:*:*) | ||
at node:internal/main/eval_string:*:* |
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 stack trace is a step backward; this test will break if this call path ever changes, which isn’t something that should be breaking a test. Can we eliminate this from the snapshot, perhaps by updating the snapshot generation script if necessary?
test: migrated tests/message to JS fixture tests
Migrated all test located in the test/message directory to the fixtures structure and verified the output to fit the .snapshot representation. All tests passed, except for the following, which were not touched. Documentation has been updated to not reference test/message as an example to run test and has been changed to test/report.
Failing tests:
out/Release/node --expose-internals /home/upx/Documents/Development/Javascript/node/test/parallel/test-fs-copyfile.js
out/Release/node /home/upx/Documents/Development/Javascript/node/test/parallel/test-fs-cp.mjs
Fixes: #47707
Refs: https://eslint.org/docs/rules/space-in-parens.html