diff --git a/README.md b/README.md index 2a973157..b6b7c7c9 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,36 @@ Type: `object`, default to `{}`. Any other options to pass to [`spawnd`](https://www.npmjs.com/package/spawnd). +#### `host` + +Type: `string`, default to `localhost`. + +Host to wait for activity on before considering the server running. +Must be used in conjunction with `port`. + +```js +module.exports = { + command: 'npm run start --port 3000', + host: 'customhost.com', + port: 3000 +} +``` + +#### `protocol` + +Type: `string`, default to `null`. + +To wait for an HTTP endpoint before considering the server running, include `http` as a protocol. +Must be used in conjunction with `port`. + +```js +module.exports = { + command: 'npm run start --port 3000', + protocol: 'http', + port: 3000 +} +``` + #### `port` Type: `number`, default to `null`. diff --git a/src/global.js b/src/global.js index e34fd3a7..73f26763 100644 --- a/src/global.js +++ b/src/global.js @@ -13,7 +13,9 @@ const DEFAULT_CONFIG = { debug: false, options: {}, launchTimeout: 5000, + host: null, port: null, + protocol: null, usedPortAction: 'ask', } @@ -155,8 +157,10 @@ export async function setup(config) { ) }), waitPort({ - port: config.port, + host: config.host, output: 'silent', + port: config.port, + protocol: config.protocol, }), ]) clearTimeout(timeout)