@@ -11,6 +11,7 @@ import * as httpProxy from "../..";
11
11
import log from "../log" ;
12
12
import getPort from "../get-port" ;
13
13
import fetch from "node-fetch" ;
14
+ import { describe , it , expect , afterAll , beforeAll } from "vitest" ;
14
15
15
16
export async function server ( ) {
16
17
const httpPort = await getPort ( ) ;
@@ -20,9 +21,9 @@ export async function server() {
20
21
res . writeHead ( 200 , { "Content-Type" : "text/plain" } ) ;
21
22
res . write (
22
23
"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 ) ,
26
27
) ;
27
28
res . end ( ) ;
28
29
} ) ;
@@ -61,7 +62,8 @@ describe("tests proxying a basic http server", () => {
61
62
62
63
describe ( "Load test against the basic proxy" , ( ) => {
63
64
let x : { proxy : httpProxy . ProxyServer ; target : http . Server ; httpPort : number ; proxyPort : number } ;
64
- it ( "creates servers" , async ( ) => {
65
+ beforeAll ( async ( ) => {
66
+ // creates servers
65
67
x = await server ( ) ;
66
68
} ) ;
67
69
@@ -108,7 +110,8 @@ describe("Load test against the basic proxy", () => {
108
110
expect ( elapsed ) . toBeLessThan ( MAX_TIME ) ;
109
111
} ) ;
110
112
111
- it ( "Cleans up" , ( ) => {
113
+ afterAll ( async ( ) => {
114
+ // Cleans up
112
115
x . proxy . close ( ) ;
113
116
x . target . close ( ) ;
114
117
} ) ;
0 commit comments