-
Notifications
You must be signed in to change notification settings - Fork 30.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: fix multiple expectedWarnings bug #19766
Conversation
Commit 8fb4ea9 ("test: add deprecation code to expectWarning") did not take into account that the same warning could be expected multiple times. This bug was discovered in nodejs#18138 and this commit adds a fix for this issue. Refs: nodejs#18138
node-test-commit failure looks unrelated01:37:40 not ok 2111 sequential/test-inspector-scriptparsed-context
01:37:40 ---
01:37:40 duration_ms: 0.508
01:37:40 severity: fail
01:37:40 stack: |-
01:37:40 [test] Connecting to a child Node process
01:37:40 [test] Testing /json/list
01:37:40 [err] Debugger listening on ws://127.0.0.1:60830/9b378dbe-1113-4be4-999e-312be19407fe
01:37:40 [err] For help see https://nodejs.org/en/docs/inspector
01:37:40 [err]
01:37:40 ... |
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.
LGTM to fix the problem at hand, but the function still doesn't seem to work as expected. Thanks for the quick fix!
@@ -631,7 +631,7 @@ function expectWarning(name, expected) { | |||
// Remove a warning message after it is seen so that we guarantee that we | |||
// get each message only once. |
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 comment seems to contradict this change.
@@ -631,7 +631,7 @@ function expectWarning(name, expected) { | |||
// Remove a warning message after it is seen so that we guarantee that we | |||
// get each message only once. | |||
map.delete(expected); |
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 seems to be a bug as well, expected
is the array of all warnings, and this call returns false
.
Commit 8fb4ea9 ("test: add deprecation code to expectWarning") did not take into account that the same warning could be expected multiple times. This bug was discovered in #18138 and this commit adds a fix for this issue. PR-URL: #19766 Refs: #18138 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
Thank you, @danbev! |
Commit 8fb4ea9 ("test: add deprecation code to expectWarning") did
not take into account that the same warning could be expected multiple
times. This bug was discovered in
#18138 and this commit adds a fix for
this issue.
Refs: #18138
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes