Skip to content

test: fix multiple expectedWarnings bug - #19766

Closed
danbev wants to merge 1 commit into
nodejs:masterfrom
danbev:test-expectWarnings-fix-length
Closed

test: fix multiple expectedWarnings bug#19766
danbev wants to merge 1 commit into
nodejs:masterfrom
danbev:test-expectWarnings-fix-length

Conversation

@danbev

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
ContributorAuthor

@danbev

Copy link
Copy Markdown
ContributorAuthor
node-test-commit failure looks unrelated

console output:

01:37:40 not ok 2111 sequential/test-inspector-scriptparsed-context01:37:40 ---01:37:40 duration_ms: 0.50801:37:40 severity: fail01:37:40 stack: |-01:37:40 [test] Connecting to a child Node process01:37:40 [test] Testing /json/list01:37:40 [err] Debugger listening on ws://127.0.0.1:60830/9b378dbe-1113-4be4-999e-312be19407fe01:37:40 [err] For help see https://nodejs.org/en/docs/inspector01:37:40 [err] 01:37:40 ...

@tniessentniessen left a comment

Copy link
Copy Markdown
Member

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!

Comment threadtest/common/index.js
@@ -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
Copy Markdown
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.

Comment threadtest/common/index.js
@@ -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
Copy Markdown
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.

@tniessentniessen mentioned this pull request Apr 4, 2018
4 tasks
@danbev

Copy link
Copy Markdown
ContributorAuthor

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

@danbevdanbev 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
Copy Markdown
Member

Thank you, @danbev!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@danbev@tniessen@jasnell@targos@nodejs-github-bot