File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " lup-system" ,
3- "version" : " 1.5.0 " ,
3+ "version" : " 1.5.1 " ,
44 "description" : " NodeJS library to retrieve system information and utilization." ,
55 "main" : " ./lib/index" ,
66 "types" : " ./lib/index.d.ts" ,
Original file line number Diff line number Diff line change 1- import { checkIfPortIsInUse , getNetworkInterfaces , stopNetworkUtilizationComputation } from '../net' ;
1+ import { isPortInUse , getNetworkInterfaces , stopNetworkUtilizationComputation } from '../net' ;
22import net from 'net' ;
33
44test ( 'getNetworkInterfaces' , async ( ) => {
@@ -8,11 +8,11 @@ test('getNetworkInterfaces', async () => {
88 expect ( nics . length ) . toBeGreaterThan ( 0 ) ;
99} , 10000 ) ;
1010
11- test ( 'checkIfPortIsInUse (12345)' , async ( ) => {
11+ test ( 'isPortInUse (12345)' , async ( ) => {
1212 const port = 12345 ;
1313
1414 // port should be free
15- const isInUse1 = await checkIfPortIsInUse ( port ) ;
15+ const isInUse1 = await isPortInUse ( port ) ;
1616 expect ( isInUse1 ) . toBe ( false ) ;
1717
1818 // start a server
@@ -21,7 +21,7 @@ test('checkIfPortIsInUse(12345)', async () => {
2121 await new Promise < void > ( ( resolve ) => server . listen ( port , '0.0.0.0' , resolve ) ) ;
2222
2323 // port should now be in use
24- const isInUse2 = await checkIfPortIsInUse ( port ) ;
24+ const isInUse2 = await isPortInUse ( port ) ;
2525 expect ( isInUse2 ) . toBe ( true ) ;
2626
2727 server . close ( ) ;
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ export function stopNetworkUtilizationComputation() {
175175 * @param bindAddress Address of the interface to bind to (default '0.0.0.0' which binds to all interfaces).
176176 * @returns Promise that resolves to true if the port is in use, false otherwise.
177177 */
178- export async function checkIfPortIsInUse ( port : number , bindAddress : string = '0.0.0.0' ) : Promise < boolean > {
178+ export async function isPortInUse ( port : number , bindAddress : string = '0.0.0.0' ) : Promise < boolean > {
179179 const server = net . createServer ( ) ;
180180 return new Promise ( ( resolve ) => {
181181 server . unref ( ) ;
You can’t perform that action at this time.
0 commit comments