Skip to content

Commit c456ca3

Browse files
cBystFishrock123
authored andcommitted
test: refactor test-tls-destroy-whilst-write
Update var to let/const and replace arbitrary timeout. PR-URL: #10064 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent fd17ca7 commit c456ca3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/parallel/test-tls-destroy-whilst-write.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
'use strict';
2-
var common = require('../common');
2+
const common = require('../common');
33

44
if (!common.hasCrypto) {
55
common.skip('missing crypto');
66
return;
77
}
8-
var tls = require('tls');
9-
var stream = require('stream');
8+
const tls = require('tls');
9+
const stream = require('stream');
1010

11-
var delay = new stream.Duplex({
11+
const delay = new stream.Duplex({
1212
read: function read() {
1313
},
1414
write: function write(data, enc, cb) {
1515
console.log('pending');
16-
setTimeout(function() {
16+
setImmediate(function() {
1717
console.log('done');
1818
cb();
19-
}, 200);
19+
});
2020
}
2121
});
2222

23-
var secure = tls.connect({
23+
const secure = tls.connect({
2424
socket: delay
2525
});
2626
setImmediate(function() {

0 commit comments

Comments
 (0)