@@ -7,8 +7,10 @@ import { expect, fetch, ignoreNetworkError, nodeOnly } from "./test-utils";
7
7
8
8
import { CA , generateCACertificate } from '../src/util/tls' ;
9
9
10
+ const nodeMajorVersion = parseInt ( process . versions . node . split ( '.' ) [ 0 ] , 10 ) ;
11
+
10
12
nodeOnly ( ( ) => {
11
- describe ( "Certificate generation" , ( ) => {
13
+ describe . only ( "Certificate generation" , ( ) => {
12
14
const caKey = fs . readFile ( path . join ( __dirname , 'fixtures' , 'test-ca.key' ) , 'utf8' ) ;
13
15
const caCert = fs . readFile ( path . join ( __dirname , 'fixtures' , 'test-ca.pem' ) , 'utf8' ) ;
14
16
@@ -58,7 +60,11 @@ nodeOnly(() => {
58
60
port : 4430 ,
59
61
ca : [ constrainedCaCert ] ,
60
62
lookup : ( hostname , options , callback ) => {
61
- callback ( null , [ { address : "127.0.0.1" , family : 4 } ] ) ;
63
+ if ( nodeMajorVersion <= 18 ) {
64
+ callback ( null , "127.0.0.1" , 4 ) ;
65
+ } else {
66
+ callback ( null , [ { address : "127.0.0.1" , family : 4 } ] ) ;
67
+ }
62
68
} ,
63
69
} ,
64
70
( res ) => {
@@ -90,7 +96,11 @@ nodeOnly(() => {
90
96
port : 4430 ,
91
97
ca : [ constrainedCaCert ] ,
92
98
lookup : ( hostname , options , callback ) => {
93
- callback ( null , [ { address : "127.0.0.1" , family : 4 } ] ) ;
99
+ if ( nodeMajorVersion <= 18 ) {
100
+ callback ( null , "127.0.0.1" , 4 ) ;
101
+ } else {
102
+ callback ( null , [ { address : "127.0.0.1" , family : 4 } ] ) ;
103
+ }
94
104
} ,
95
105
} ,
96
106
) ;
0 commit comments