test: fix multiple expectedWarnings bug

Commit 8fb4ea9f75 ("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
https://github.com/nodejs/node/pull/18138 and this commit adds a fix for
this issue.

PR-URL: https://github.com/nodejs/node/pull/19766
Refs: https://github.com/nodejs/node/pull/18138
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Daniel Bevenius 2018-04-03 07:16:13 +02:00
parent e37effe4ce
commit 682b85036e

View File

@ -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);
}, map.size);
}, expected.length);
}
function expectWarningByName(name, expected, code) {