@@ -4,7 +4,6 @@ import * as tls from 'tls';
44import * as http from 'http' ;
55import * as https from 'https' ;
66import * as http2 from 'http2' ;
7- import * as semver from 'semver' ;
87import * as fs from 'fs' ;
98import * as portfinder from 'portfinder' ;
109
@@ -18,9 +17,9 @@ import {
1817 makeDestroyable ,
1918 cleanup ,
2019 fetch ,
21- H2_TLS_ON_TLS_SUPPORTED ,
2220 BROKEN_H2_OVER_H2_TUNNELLING ,
23- getDeferred
21+ getDeferred ,
22+ nodeSatisfies
2423} from "../test-utils" ;
2524
2625browserOnly ( ( ) => {
@@ -80,7 +79,7 @@ nodeOnly(() => {
8079
8180 describe ( "without TLS" , function ( ) {
8281
83- if ( semver . satisfies ( process . version , BROKEN_H2_OVER_H2_TUNNELLING ) ) return ;
82+ if ( nodeSatisfies ( BROKEN_H2_OVER_H2_TUNNELLING ) ) return ;
8483
8584 const server = getLocal ( ) ;
8685
@@ -375,8 +374,6 @@ nodeOnly(() => {
375374 } ) ;
376375
377376 it ( "can respond to proxied HTTP/2 requests" , async function ( ) {
378- if ( ! semver . satisfies ( process . version , H2_TLS_ON_TLS_SUPPORTED ) ) this . skip ( ) ;
379-
380377 await server . forGet ( 'https://example.com/mocked-endpoint' )
381378 . thenReply ( 200 , "Proxied HTTP2 response!" ) ;
382379
@@ -413,8 +410,6 @@ nodeOnly(() => {
413410 } ) ;
414411
415412 it ( "should include request metadata in events for proxied HTTP/2 requests" , async function ( ) {
416- if ( ! semver . satisfies ( process . version , H2_TLS_ON_TLS_SUPPORTED ) ) this . skip ( ) ;
417-
418413 let seenRequestPromise = getDeferred < CompletedRequest > ( ) ;
419414 await server . on ( 'request' , ( r ) => seenRequestPromise . resolve ( r ) ) ;
420415
@@ -462,8 +457,6 @@ nodeOnly(() => {
462457 } ) ;
463458
464459 it ( "should include response metadata in events for proxied HTTP/2 responses" , async function ( ) {
465- if ( ! semver . satisfies ( process . version , H2_TLS_ON_TLS_SUPPORTED ) ) this . skip ( ) ;
466-
467460 let seenResponsePromise = getDeferred < CompletedResponse > ( ) ;
468461 await server . on ( 'response' , ( r ) => seenResponsePromise . resolve ( r ) ) ;
469462
@@ -515,8 +508,6 @@ nodeOnly(() => {
515508 } ) ;
516509
517510 it ( "can respond to HTTP1-proxied HTTP/2 requests" , async function ( ) {
518- if ( ! semver . satisfies ( process . version , H2_TLS_ON_TLS_SUPPORTED ) ) this . skip ( ) ;
519-
520511 await server . forGet ( 'https://example.com/mocked-endpoint' )
521512 . thenReply ( 200 , "Proxied HTTP2 response!" ) ;
522513
@@ -579,8 +570,6 @@ nodeOnly(() => {
579570 afterEach ( ( ) => http2Server . destroy ( ) ) ;
580571
581572 it ( "can pass through end-to-end HTTP/2" , async function ( ) {
582- if ( ! semver . satisfies ( process . version , H2_TLS_ON_TLS_SUPPORTED ) ) this . skip ( ) ;
583-
584573 await server . forGet ( `https://localhost:${ targetPort } /` )
585574 . thenPassThrough ( { ignoreHostHttpsErrors : [ 'localhost' ] } ) ;
586575
0 commit comments