diff --git a/README.md b/README.md index d54ee9e..5e9664a 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,19 @@ Requires [Node](https://nodejs.org/en/) version 8.9 or above. npm install --save-dev start-server-and-test ``` +## Upgrade + +### v1 to v2 + +If you are using just the port number, and the resolved URL `localhost:xxxx` no longer works, use the explicit `http://localhost:xxxx` instead + +``` +# v1 +$ npx start-test 3000 +# v2 +$ npx start-test http://localhost:3000 +``` + ## Use This command is meant to be used with NPM script commands. If you have a "start server", and "test" script names for example, you can start the server, wait for a url to respond, then run tests. When the test process exits, the server is shut down. diff --git a/src/utils.js b/src/utils.js index 94c0037..abd1a69 100644 --- a/src/utils.js +++ b/src/utils.js @@ -214,7 +214,11 @@ const normalizeUrl = input => { return s } - if (s.startsWith('localhost') || s.startsWith('127.0.0.1') || s.startsWith('0.0.0.0')) { + if ( + s.startsWith('localhost') || + s.startsWith('127.0.0.1') || + s.startsWith('0.0.0.0') + ) { return `http://${s}` }