@@ -11,6 +11,7 @@ import * as httpProxy from "../..";
1111import log from "../log" ;
1212import getPort from "../get-port" ;
1313import fetch from "node-fetch" ;
14+ import { describe , it , expect , afterAll , beforeAll } from "vitest" ;
1415
1516export async function server ( ) {
1617 const httpPort = await getPort ( ) ;
@@ -20,9 +21,9 @@ export async function server() {
2021 res . writeHead ( 200 , { "Content-Type" : "text/plain" } ) ;
2122 res . write (
2223 "request successfully proxied to: " +
23- req . url +
24- "\n" +
25- JSON . stringify ( req . headers , undefined , 2 ) ,
24+ req . url +
25+ "\n" +
26+ JSON . stringify ( req . headers , undefined , 2 ) ,
2627 ) ;
2728 res . end ( ) ;
2829 } ) ;
@@ -61,7 +62,8 @@ describe("tests proxying a basic http server", () => {
6162
6263describe ( "Load test against the basic proxy" , ( ) => {
6364 let x : { proxy : httpProxy . ProxyServer ; target : http . Server ; httpPort : number ; proxyPort : number } ;
64- it ( "creates servers" , async ( ) => {
65+ beforeAll ( async ( ) => {
66+ // creates servers
6567 x = await server ( ) ;
6668 } ) ;
6769
@@ -108,7 +110,8 @@ describe("Load test against the basic proxy", () => {
108110 expect ( elapsed ) . toBeLessThan ( MAX_TIME ) ;
109111 } ) ;
110112
111- it ( "Cleans up" , ( ) => {
113+ afterAll ( async ( ) => {
114+ // Cleans up
112115 x . proxy . close ( ) ;
113116 x . target . close ( ) ;
114117 } ) ;
0 commit comments