Skip to content

Commit a9e395c

Browse files
authoredFeb 27, 2023
feat: making the default host 127.0.0.1 (#359)
* feat: upgrade to v2 BREAKING CHANGE: default host to ping is 127.0.0.1 * code format
1 parent 9df0423 commit a9e395c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
 

‎README.md

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ Requires [Node](https://nodejs.org/en/) version 8.9 or above.
1717
npm install --save-dev start-server-and-test
1818
```
1919

20+
## Upgrade
21+
22+
### v1 to v2
23+
24+
If you are using just the port number, and the resolved URL `localhost:xxxx` no longer works, use the explicit `http://localhost:xxxx` instead
25+
26+
```
27+
# v1
28+
$ npx start-test 3000
29+
# v2
30+
$ npx start-test http://localhost:3000
31+
```
32+
2033
## Use
2134

2235
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.

‎src/utils.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ const normalizeUrl = input => {
214214
return s
215215
}
216216

217-
if (s.startsWith('localhost') || s.startsWith('127.0.0.1') || s.startsWith('0.0.0.0')) {
217+
if (
218+
s.startsWith('localhost') ||
219+
s.startsWith('127.0.0.1') ||
220+
s.startsWith('0.0.0.0')
221+
) {
218222
return `http://${s}`
219223
}
220224

0 commit comments

Comments
 (0)
Please sign in to comment.