test: make sigint test to actually check child pid#1656
Merged
remy merged 1 commit intoremy:masterfrom Jan 22, 2020
Merged
Conversation
|
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. |
Contributor
Author
|
Actually, this is just a preparation for another fix, for more serious issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The aim of this PR is to fix some issues in SIGINT test.
The problem
Due to combination of the following effects, the SIGINT test does not actually test what it is made for:
string.replacemethod takes the child pid from incorrect parameter:nodemon/test/misc/sigint.test.js
Lines 16 to 22 in cd45d74
According to MDN, the first parameter contains entire substring, not the first capture group. As the result, the
childPIDcontains string, not just number (“pid: 1234”).nodemon/test/fixtures/sigint.js
Lines 1 to 3 in cd45d74
In fact, you can see it in the process list after running tests even if all tests pass.
nodemon/test/misc/sigint.test.js
Lines 37 to 42 in cd45d74
This happens because
childPIDis string andprocess.killrequires number and throws an exception. Due to exception, the test code assumes the child is not running and test passes.Tested on:
master)The fix
I implemented the following fixes:
--dont-exitparameter is passed. In all other cases it exits upon receiving SIGINT as any normal application would do.