chore: listen on localhost for html report (#16205)

This commit is contained in:
jfgreffier 2022-08-10 11:05:31 +02:00 committed by GitHub
parent 4cbb95e06d
commit fb91f829d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,7 @@ export class HttpServer {
this._activeSockets.add(socket); this._activeSockets.add(socket);
socket.once('close', () => this._activeSockets.delete(socket)); socket.once('close', () => this._activeSockets.delete(socket));
}); });
this._server.listen(port, '127.0.0.1'); this._server.listen(port, 'localhost');
await new Promise(cb => this._server!.once('listening', cb)); await new Promise(cb => this._server!.once('listening', cb));
const address = this._server.address(); const address = this._server.address();
assert(address, 'Could not bind server socket'); assert(address, 'Could not bind server socket');
@ -67,7 +67,7 @@ export class HttpServer {
this._urlPrefix = address; this._urlPrefix = address;
} else { } else {
this._port = address.port; this._port = address.port;
this._urlPrefix = `http://127.0.0.1:${address.port}`; this._urlPrefix = `http://localhost:${address.port}`;
} }
} }
return this._urlPrefix; return this._urlPrefix;