Skip to content

Commit

Permalink
add port option, #175
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jul 12, 2021
1 parent 78a50d0 commit a09b588
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/common/withServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ const winston = require( 'winston' );
* @returns {Promise}
*/
module.exports = function( asyncCallback, options ) {

options = _.merge( {
path: '../'
path: '../',
port: 0 // 0 means it will find an open port
}, options );

return new Promise( ( resolve, reject ) => {
Expand Down Expand Up @@ -89,7 +91,6 @@ module.exports = function( asyncCallback, options ) {
} );
} );

// 0 means it will find an open port
server.listen( 0 );
server.listen( options.port );
} );
};

0 comments on commit a09b588

Please sign in to comment.