test: complete coverage of lib/child_process.js#12367
Conversation
Trott
left a comment
There was a problem hiding this comment.
LGTM is CI is green.
Would also be OK with removing the check in a subsequent semver-major but don't much care either way. Seems the risk is small and so is the benefit, so /shrug
There was a problem hiding this comment.
Can u please move the require('../common') to line 2 as indicated in the writing testing guide?
|
I'm thinking that unlikely does not make it dead code, so better safe than sorry. |
|
Test fails on Windows. Maybe some characters in the path are being treated as special characters in the regular expression created through the constructor. Looking at it, I think the regular expression isn't needed. Just create a string and do an |
There was a problem hiding this comment.
This could just be a string rather than a regexp...
There was a problem hiding this comment.
...and then this could be assert.strictEqual().
Trott
left a comment
There was a problem hiding this comment.
Marking as "request changes" until the Windows situation is fixed, just to make sure no one lands it without noting the problem.
|
New CI with the regular expression changed to a string. Passes locally on Windows now. |
This commit adds a test which brings coverage of lib/child_process.js to 100%. It adds coverage for the call to uv.errname() in execFile()'s exithandler() function. PR-URL: nodejs#12367 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit adds a test which brings coverage of lib/child_process.js to 100%. It adds coverage for the call to uv.errname() in execFile()'s exithandler() function. PR-URL: #12367 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit adds a test which brings coverage of lib/child_process.js to 100%. It adds coverage for the call to uv.errname() in execFile()'s exithandler() function. PR-URL: #12367 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit adds a test which brings coverage of lib/child_process.js to 100%. It adds coverage for the call to uv.errname() in execFile()'s exithandler() function. PR-URL: #12367 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit adds a test which brings coverage of lib/child_process.js to 100%. It adds coverage for the call to uv.errname() in execFile()'s exithandler() function. PR-URL: #12367 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit adds a test which brings coverage of lib/child_process.js to 100%. It adds coverage for the call to uv.errname() in execFile()'s exithandler() function. PR-URL: #12367 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit adds a test which brings coverage of lib/child_process.js to 100%. It adds coverage for the call to uv.errname() in execFile()'s exithandler() function. PR-URL: nodejs/node#12367 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit adds a test which brings coverage of
lib/child_process.jsto 100%. It adds coverage for the call touv.errname()inexecFile()'sexithandler()function.I haven't been able to hit this line of code completely naturally, but as shown in the test, it can be done with public APIs. So, there is a question of whether that line of code needs to exist. To execute that line:
exithandler()must be called for the first time.execFile().exmust not be set andcodemust be less than zero.Out of the three call sites of
exithandler(), the child process'close'handler is the only one that does not setex. The'close'event is emitted once all of child processes streams have been closed. I find it unlikely that all of the streams will be closed before an error is emitted. That would make the code in question dead code. However, I'd like to avoid possibly breaking anyone, and it's technically possible to recreate the case, as shown in the test.cc: @Trott
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test