Skip to content

Commit c35e403

Browse files
committed
fix(jest-dev-server): no default host
BREAKING CHANGE: default host is now `undefined` instead of "localhost"
1 parent 351720a commit c35e403

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/jest-dev-server/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Following options are linked to [`spawnd`](https://www.npmjs.com/package/spawnd)
117117

118118
### `host`
119119

120-
Type: `string`, default to `localhost`.
120+
Type: `string`, if not specified it will used Node.js default port.
121121

122122
Host to wait for activity on before considering the server running.
123123
Must be used in conjunction with `port`.

packages/jest-dev-server/src/index.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export type Config = {
3737
launchTimeout?: number;
3838
/**
3939
* Host to use to check if the port is used.
40-
* @default "localhost"
4140
*/
4241
host?: string;
4342
/**
@@ -69,7 +68,7 @@ const DEFAULT_CONFIG: Partial<Config> = {
6968
debug: false,
7069
options: {},
7170
launchTimeout: 5000,
72-
host: "localhost",
71+
host: undefined,
7372
port: undefined,
7473
protocol: "tcp",
7574
usedPortAction: "ask",
@@ -238,7 +237,7 @@ const waitForServerToBeReady = async (config: Config) => {
238237
if (config.port === undefined) return;
239238
const { launchTimeout, protocol, host, port, path, waitOnScheme } = config;
240239

241-
let resource = `${host}:${port}`;
240+
let resource = `${host ?? "0.0.0.0"}:${port}`;
242241
if (path) {
243242
resource = `${resource}/${path}`;
244243
}

0 commit comments

Comments
 (0)