@@ -4,6 +4,11 @@ import { HTTPServerProxyTestSetup } from '../test/helpers';
4
4
5
5
describe ( 'createFetch' , function ( ) {
6
6
it ( "consistency check: plain `import('node-fetch')` fails" , async function ( ) {
7
+ if ( process . versions . node >= '20.19.0' ) {
8
+ // 'node 20.19.0 has require(esm) enabled by default'
9
+ return this . skip ( ) ;
10
+ }
11
+
7
12
let failed = false ;
8
13
try {
9
14
await import ( 'node-fetch' ) ;
@@ -30,7 +35,7 @@ describe('createFetch', function () {
30
35
31
36
it ( 'provides a node-fetch-like HTTP functionality' , async function ( ) {
32
37
const response = await createFetch ( { } ) (
33
- `http://127.0.0.1:${ setup . httpServerPort } /test` ,
38
+ `http://127.0.0.1:${ setup . httpServerPort } /test`
34
39
) ;
35
40
expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
36
41
} ) ;
@@ -40,7 +45,7 @@ describe('createFetch', function () {
40
45
proxy :
`ssh://[email protected] :${ setup . sshProxyPort } ` ,
41
46
} ) ;
42
47
const response = await fetch (
43
- `http://localhost:${ setup . httpServerPort } /test` ,
48
+ `http://localhost:${ setup . httpServerPort } /test`
44
49
) ;
45
50
expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
46
51
expect ( setup . sshTunnelInfos ) . to . deep . equal ( [
@@ -58,7 +63,7 @@ describe('createFetch', function () {
58
63
proxy : `http://127.0.0.1:${ setup . httpProxyPort } ` ,
59
64
} ) ;
60
65
const response = await fetch (
61
- `http://localhost:${ setup . httpServerPort } /test` ,
66
+ `http://localhost:${ setup . httpServerPort } /test`
62
67
) ;
63
68
expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
64
69
} ) ;
@@ -69,7 +74,7 @@ describe('createFetch', function () {
69
74
ca : setup . tlsOptions . ca ,
70
75
} ) ;
71
76
const response = await fetch (
72
- `https://localhost:${ setup . httpsServerPort } /test` ,
77
+ `https://localhost:${ setup . httpsServerPort } /test`
73
78
) ;
74
79
expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
75
80
} ) ;
@@ -80,7 +85,7 @@ describe('createFetch', function () {
80
85
proxy : `socks5://127.0.0.1:${ setup . socks5ProxyPort } ` ,
81
86
} ) ;
82
87
const response = await fetch (
83
- `http://localhost:${ setup . httpServerPort } /test` ,
88
+ `http://localhost:${ setup . httpServerPort } /test`
84
89
) ;
85
90
expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
86
91
} ) ;
@@ -91,7 +96,7 @@ describe('createFetch', function () {
91
96
proxy : `pac+http://127.0.0.1:${ setup . httpServerPort } /pac` ,
92
97
} ) ;
93
98
const response = await fetch (
94
- `http://localhost:${ setup . httpsServerPort } /test` ,
99
+ `http://localhost:${ setup . httpsServerPort } /test`
95
100
) ;
96
101
expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
97
102
@@ -100,7 +105,7 @@ describe('createFetch', function () {
100
105
expect . fail ( 'missed exception' ) ;
101
106
} catch ( err ) {
102
107
expect ( err . message ) . to . include (
103
- 'Failed to establish a socket connection to proxies: ["SOCKS5 127.0.0.1:1"]' ,
108
+ 'Failed to establish a socket connection to proxies: ["SOCKS5 127.0.0.1:1"]'
104
109
) ;
105
110
}
106
111
} ) ;
0 commit comments