test: don't hard code deprecation count
PR-URL: https://github.com/nodejs/node/pull/7927 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
65a42ab892
commit
c52a9730b8
@ -9,6 +9,11 @@ if (!common.hasCrypto) {
|
||||
const crypto = require('crypto');
|
||||
const tls = require('tls');
|
||||
|
||||
const expected = [
|
||||
'crypto.Credentials is deprecated. Use tls.SecureContext instead.',
|
||||
'crypto.createCredentials is deprecated. Use tls.createSecureContext instead.'
|
||||
];
|
||||
|
||||
process.on('warning', common.mustCall((warning) => {
|
||||
assert.strictEqual(warning.name, 'DeprecationWarning');
|
||||
assert.notStrictEqual(expected.indexOf(warning.message), -1,
|
||||
@ -16,12 +21,7 @@ process.on('warning', common.mustCall((warning) => {
|
||||
// Remove a warning message after it is seen so that we guarantee that we get
|
||||
// each message only once.
|
||||
expected.splice(expected.indexOf(warning.message), 1);
|
||||
}, 2));
|
||||
|
||||
var expected = [
|
||||
'crypto.Credentials is deprecated. Use tls.SecureContext instead.',
|
||||
'crypto.createCredentials is deprecated. Use tls.createSecureContext instead.'
|
||||
];
|
||||
}, expected.length));
|
||||
|
||||
// Accessing the deprecated function is enough to trigger the warning event.
|
||||
// It does not need to be called. So the assert serves the purpose of both
|
||||
|
Loading…
x
Reference in New Issue
Block a user