This repository was archived by the owner on Jun 18, 2021. It is now read-only.
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.
Uh oh!
There was an error while loading. Please reload this page.
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 not sure how https://ci.nodejs.org/view/post-mortem/job/nodereport-continuous-integration/52/MACHINE=win10/console passed given that the slash here is incorrect for Windows (test is failing locally for me).
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.
ah it's because the test script in package.json uses forward slashes so the test does match:
I was using backslashes on the command line when running the individual test locally.
Uh oh!
There was an error while loading. Please reload this page.
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.
hmm so while everything passes when run with npm test, it looks like other ways of running the test fails:
e.g.
test/test-api-getreport.js,e.g.
Also note that Node.js seems to fully qualify process.argv[0], so process.argv0 would be the correct thing to use if it is available (but would not fix the test looking for
test/test-api-getreport.js).e.g.
The other tests that check the expected command line are creating child processes to get the report from, so know exactly what command line is invoked. This test doesn't have that control, so is less robust if run in ways other than
npm test. Are we concerned about these?Uh oh!
There was an error while loading. Please reload this page.
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.
Couldn't you just check that
test/test-api-getreport.jsexists, and trytest\test-api-getreport.jsotherwise (and fail if neither exist)?process.argv[0]seems like the way to go for your other issue.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.
That would address 1. but not 2.
Uh oh!
There was an error while loading. Please reload this page.
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.
Could you use
process.argv[1]to get the path to the test?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.
Unfortunately not, Node.js resolves it like it does argv[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.
I think the best option would be to assume the test path was the direct relative path to the test. You should be able to use
process.titleinstead ofprocess.argv0(I couldn't get this to not work, but I didn't try windows, YMMV).Obviously that wouldn't handle things like
node $PWD/test-api-getreport.js, or weird things likenode test/../test/test-api-getreport.js, but it should hopefully handle windows and manually running the tests (i.e. all common situations).