File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed
Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,6 @@ const isAvailable = options => new Promise((resolve, reject) => {
1414} ) ;
1515
1616const getPort = ( options = { } ) => new Promise ( ( resolve , reject ) => {
17- // For backwards compatibility with number-only input
18- // TODO: Remove this in the next major version
19- if ( typeof options === 'number' ) {
20- options = { port : options } ;
21- }
22-
2317 if ( typeof options . port === 'number' ) {
2418 options . port = [ options . port ] ;
2519 }
@@ -34,5 +28,5 @@ const getPort = (options = {}) => new Promise((resolve, reject) => {
3428} ) ;
3529
3630module . exports = options => options ?
37- getPort ( options ) . catch ( ( ) => getPort ( 0 ) ) :
38- getPort ( 0 ) ;
31+ getPort ( options ) . catch ( ( ) => getPort ( { port : 0 } ) ) :
32+ getPort ( { port : 0 } ) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ test('port can be bound when promise resolves', async t => {
1616
1717test ( 'preferred port' , async t => {
1818 const desiredPort = 8080 ;
19- const port = await m ( desiredPort ) ;
19+ const port = await m ( { port : desiredPort } ) ;
2020
2121 t . is ( port , desiredPort ) ;
2222} ) ;
@@ -28,7 +28,7 @@ test('preferred port unavailable', async t => {
2828 const server = net . createServer ( ) ;
2929 await pify ( server . listen . bind ( server ) ) ( desiredPort ) ;
3030
31- const port = await m ( desiredPort ) ;
31+ const port = await m ( { port : desiredPort } ) ;
3232 t . is ( typeof port , 'number' ) ;
3333 t . true ( port > 0 ) ;
3434 t . not ( port , desiredPort ) ;
You can’t perform that action at this time.
0 commit comments