@@ -8,6 +8,9 @@ import * as statik from '../../lib/node-static.js';
88const __dirname = import . meta. dirname ;
99
1010let testPort = 8151 ;
11+ const getTestServer = ( ) => {
12+ return 'http://localhost:' + testPort ;
13+ } ;
1114
1215/**
1316 * @param {Mocha.Context } obj
@@ -94,7 +97,7 @@ const gzipFileServer = new statik.Server(__dirname + '/../fixtures', {
9497 * @param {number } port
9598 * @param {Record<string, string> } headers
9699 */
97- function startStaticFileServerWithHeaders ( port , headers ) {
100+ function startStaticFileServerWithGzipAndHeaders ( port , headers ) {
98101 return new Promise ( ( resolve , reject ) => {
99102 const server = http . createServer ( function ( request , response ) {
100103 /* c8 ignore next 3 -- TS */
@@ -159,9 +162,6 @@ describe('node-static', function () {
159162 } ) ;
160163 it ( 'streaming a 404 page' , async function ( ) {
161164 testPort ++ ;
162- const getTestServer = ( ) => {
163- return 'http://localhost:' + testPort ;
164- } ;
165165 const server = await startStaticServerWithCallback ( testPort , ( request , response , err , result ) => {
166166 if ( err ) {
167167 response . writeHead ( err . status , err . headers ) ;
@@ -185,10 +185,7 @@ describe('node-static', function () {
185185
186186 it ( 'mixes Vary headers' , async function ( ) {
187187 testPort ++ ;
188- const getTestServer = ( ) => {
189- return 'http://localhost:' + testPort ;
190- } ;
191- const server = await startStaticFileServerWithHeaders ( testPort , {
188+ const server = await startStaticFileServerWithGzipAndHeaders ( testPort , {
192189 'Vary' : 'Accept-Language'
193190 } ) ;
194191
@@ -208,9 +205,6 @@ describe('node-static', function () {
208205
209206 it ( 'get error triggered for file serving' , function ( done ) {
210207 testPort ++ ;
211- const getTestServer = ( ) => {
212- return 'http://localhost:' + testPort ;
213- } ;
214208
215209 /** @type {http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> } */
216210 let server ;
0 commit comments