Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Apr 3, 2018

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), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

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
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Apr 3, 2018
@danbev
Copy link
Contributor Author

danbev commented Apr 3, 2018

@danbev
Copy link
Contributor Author

danbev commented Apr 3, 2018

node-test-commit failure looks unrelated

console output:

01: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   ...

Copy link
Member

@tniessen tniessen left a 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.
Copy link
Member

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);
Copy link
Member

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.

@tniessen tniessen mentioned this pull request Apr 4, 2018
4 tasks
@danbev
Copy link
Contributor Author

danbev commented Apr 6, 2018

Landed in 682b850.
I'll follow up the issue raised by @tniessen next week.

@danbev danbev closed this Apr 6, 2018
danbev added a commit that referenced this pull request Apr 6, 2018
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>
@danbev danbev deleted the test-expectWarnings-fix-length branch April 6, 2018 01:23
@tniessen
Copy link
Member

tniessen commented Apr 6, 2018

Thank you, @danbev!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants