This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,9 @@ export class Server<
245245 `listen EADDRINUSE: address already in use ${
246246 host || DEFAULT_HOST
247247 } :${ portNumber } .`
248- ) ;
248+ ) as NodeJS . ErrnoException ;
249+ // emulate part of node's EADDRINUSE error:
250+ err . code = "EADDRINUSE" ;
249251 throw err ;
250252 }
251253 } )
Original file line number Diff line number Diff line change @@ -493,10 +493,10 @@ describe("server", () => {
493493 server . listen ( port ) ;
494494
495495 try {
496- await assert . rejects (
497- setup ( ) ,
498- `Error: listen EADDRINUSE: address already in use 127.0.0.1: ${ port } .`
499- ) ;
496+ await assert . rejects ( setup ( ) , {
497+ message : `listen EADDRINUSE: address already in use 127.0.0.1: ${ port } .` ,
498+ code : " EADDRINUSE"
499+ } ) ;
500500 } finally {
501501 await Promise . all ( [
502502 teardown ( ) ,
@@ -517,7 +517,8 @@ describe("server", () => {
517517 const s = Ganache . server ( ) ;
518518 const listen = promisify ( s . listen . bind ( s ) ) ;
519519 await assert . rejects ( listen ( port ) , {
520- message : `listen EADDRINUSE: address already in use 127.0.0.1:${ port } .`
520+ message : `listen EADDRINUSE: address already in use 127.0.0.1:${ port } .` ,
521+ code : "EADDRINUSE"
521522 } ) ;
522523 } finally {
523524 await Promise . all ( [
You can’t perform that action at this time.
0 commit comments