@@ -4,6 +4,11 @@ import { HTTPServerProxyTestSetup } from '../test/helpers';
44
55describe ( 'createFetch' , function ( ) {
66 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+
712 let failed = false ;
813 try {
914 await import ( 'node-fetch' ) ;
@@ -30,7 +35,7 @@ describe('createFetch', function () {
3035
3136 it ( 'provides a node-fetch-like HTTP functionality' , async function ( ) {
3237 const response = await createFetch ( { } ) (
33- `http://127.0.0.1:${ setup . httpServerPort } /test` ,
38+ `http://127.0.0.1:${ setup . httpServerPort } /test`
3439 ) ;
3540 expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
3641 } ) ;
@@ -40,7 +45,7 @@ describe('createFetch', function () {
4045 proxy :
`ssh://[email protected] :${ setup . sshProxyPort } ` , 4146 } ) ;
4247 const response = await fetch (
43- `http://localhost:${ setup . httpServerPort } /test` ,
48+ `http://localhost:${ setup . httpServerPort } /test`
4449 ) ;
4550 expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
4651 expect ( setup . sshTunnelInfos ) . to . deep . equal ( [
@@ -58,7 +63,7 @@ describe('createFetch', function () {
5863 proxy : `http://127.0.0.1:${ setup . httpProxyPort } ` ,
5964 } ) ;
6065 const response = await fetch (
61- `http://localhost:${ setup . httpServerPort } /test` ,
66+ `http://localhost:${ setup . httpServerPort } /test`
6267 ) ;
6368 expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
6469 } ) ;
@@ -69,7 +74,7 @@ describe('createFetch', function () {
6974 ca : setup . tlsOptions . ca ,
7075 } ) ;
7176 const response = await fetch (
72- `https://localhost:${ setup . httpsServerPort } /test` ,
77+ `https://localhost:${ setup . httpsServerPort } /test`
7378 ) ;
7479 expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
7580 } ) ;
@@ -80,7 +85,7 @@ describe('createFetch', function () {
8085 proxy : `socks5://127.0.0.1:${ setup . socks5ProxyPort } ` ,
8186 } ) ;
8287 const response = await fetch (
83- `http://localhost:${ setup . httpServerPort } /test` ,
88+ `http://localhost:${ setup . httpServerPort } /test`
8489 ) ;
8590 expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
8691 } ) ;
@@ -91,7 +96,7 @@ describe('createFetch', function () {
9196 proxy : `pac+http://127.0.0.1:${ setup . httpServerPort } /pac` ,
9297 } ) ;
9398 const response = await fetch (
94- `http://localhost:${ setup . httpsServerPort } /test` ,
99+ `http://localhost:${ setup . httpsServerPort } /test`
95100 ) ;
96101 expect ( await response . text ( ) ) . to . equal ( 'OK /test' ) ;
97102
@@ -100,7 +105,7 @@ describe('createFetch', function () {
100105 expect . fail ( 'missed exception' ) ;
101106 } catch ( err ) {
102107 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"]'
104109 ) ;
105110 }
106111 } ) ;
0 commit comments