Skip to content

Commit b16d9e6

Browse files
committed
test: don't hard code deprecation count
1 parent c948877 commit b16d9e6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

test/parallel/test-crypto-deprecated.js

Lines changed: 6 additions & 6 deletions
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)