Skip to content

Commit c52a973

Browse files
princejwesleyjasnell
authored andcommitted
test: don't hard code deprecation count
PR-URL: #7927 Reviewed-By: Brian White <[email protected]> Reviewed-By: Claudio Rodriguez <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 65a42ab commit c52a973

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/parallel/test-crypto-deprecated.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ if (!common.hasCrypto) {
99
const crypto = require('crypto');
1010
const tls = require('tls');
1111

12+
const expected = [
13+
'crypto.Credentials is deprecated. Use tls.SecureContext instead.',
14+
'crypto.createCredentials is deprecated. Use tls.createSecureContext instead.'
15+
];
16+
1217
process.on('warning', common.mustCall((warning) => {
1318
assert.strictEqual(warning.name, 'DeprecationWarning');
1419
assert.notStrictEqual(expected.indexOf(warning.message), -1,
1520
`unexpected error message: "${warning.message}"`);
1621
// Remove a warning message after it is seen so that we guarantee that we get
1722
// each message only once.
1823
expected.splice(expected.indexOf(warning.message), 1);
19-
}, 2));
20-
21-
var expected = [
22-
'crypto.Credentials is deprecated. Use tls.SecureContext instead.',
23-
'crypto.createCredentials is deprecated. Use tls.createSecureContext instead.'
24-
];
24+
}, expected.length));
2525

2626
// Accessing the deprecated function is enough to trigger the warning event.
2727
// It does not need to be called. So the assert serves the purpose of both

0 commit comments

Comments
 (0)