1
1
'use strict' ;
2
- var common = require ( '../common' ) ;
3
- var assert = require ( 'assert' ) ;
2
+ const common = require ( '../common' ) ;
3
+ const assert = require ( 'assert' ) ;
4
4
5
5
if ( ! common . hasCrypto ) {
6
6
common . skip ( 'missing crypto' ) ;
7
7
return ;
8
8
}
9
- var tls = require ( 'tls' ) ;
9
+ const tls = require ( 'tls' ) ;
10
10
11
- var fs = require ( 'fs' ) ;
12
- var spawn = require ( 'child_process' ) . spawn ;
11
+ const fs = require ( 'fs' ) ;
12
+ const spawn = require ( 'child_process' ) . spawn ;
13
13
14
14
if ( common . opensslCli === false ) {
15
15
common . skip ( 'node compiled without OpenSSL CLI.' ) ;
16
16
return ;
17
17
}
18
18
19
- var cert = fs . readFileSync ( common . fixturesDir + '/test_cert.pem' ) ;
20
- var key = fs . readFileSync ( common . fixturesDir + '/test_key.pem' ) ;
21
- var server = tls . createServer ( { cert : cert , key : key } , common . fail ) ;
22
- var errors = [ ] ;
23
- var stderr = '' ;
19
+ const cert = fs . readFileSync ( common . fixturesDir + '/test_cert.pem' ) ;
20
+ const key = fs . readFileSync ( common . fixturesDir + '/test_key.pem' ) ;
21
+ const server = tls . createServer ( { cert : cert , key : key } , common . fail ) ;
22
+ const errors = [ ] ;
23
+ let stderr = '' ;
24
24
25
25
server . listen ( 0 , '127.0.0.1' , function ( ) {
26
- var address = this . address ( ) . address + ':' + this . address ( ) . port ;
27
- var args = [ 's_client' ,
26
+ const address = this . address ( ) . address + ':' + this . address ( ) . port ;
27
+ const args = [ 's_client' ,
28
28
'-ssl3' ,
29
29
'-connect' , address ] ;
30
30
31
31
// for the performance and stability issue in s_client on Windows
32
32
if ( common . isWindows )
33
33
args . push ( '-no_rand_screen' ) ;
34
34
35
- var client = spawn ( common . opensslCli , args , { stdio : 'pipe' } ) ;
35
+ const client = spawn ( common . opensslCli , args , { stdio : 'pipe' } ) ;
36
36
client . stdout . pipe ( process . stdout ) ;
37
37
client . stderr . pipe ( process . stderr ) ;
38
38
client . stderr . setEncoding ( 'utf8' ) ;
39
39
client . stderr . on ( 'data' , ( data ) => stderr += data ) ;
40
40
41
41
client . once ( 'exit' , common . mustCall ( function ( exitCode ) {
42
- assert . equal ( exitCode , 1 ) ;
42
+ assert . strictEqual ( exitCode , 1 ) ;
43
43
server . close ( ) ;
44
44
} ) ) ;
45
45
} ) ;
@@ -50,7 +50,7 @@ process.on('exit', function() {
50
50
if ( / u n k n o w n o p t i o n - s s l 3 / . test ( stderr ) ) {
51
51
common . skip ( '`openssl s_client -ssl3` not supported.' ) ;
52
52
} else {
53
- assert . equal ( errors . length , 1 ) ;
53
+ assert . strictEqual ( errors . length , 1 ) ;
54
54
assert ( / : w r o n g v e r s i o n n u m b e r / . test ( errors [ 0 ] . message ) ) ;
55
55
}
56
56
} ) ;
0 commit comments