Skip to content

Commit 4ff9fb3

Browse files
committed
test: more
1 parent 196341d commit 4ff9fb3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/Server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ class Server {
750750
}
751751
}
752752

753-
listen(port, hostname, fn) {
753+
listen(port, hostname = this.options.host, fn) {
754754
if (
755755
typeof this.options.host !== 'undefined' &&
756756
hostname !== this.options.host

test/server/Server.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jest.mock('sockjs/lib/transport');
1212

1313
const baseDevConfig = {
1414
port,
15-
host: 'localhost',
1615
static: false,
1716
};
1817

@@ -148,6 +147,17 @@ describe('Server', () => {
148147
server.close(done);
149148
});
150149

150+
it('should work and listen', (done) => {
151+
const options = {
152+
host: 'localhost',
153+
};
154+
155+
server = new Server(compiler, options);
156+
157+
expect(() => server.listen(port)).not.toThrowError();
158+
server.close(done);
159+
});
160+
151161
it('should throw an error', (done) => {
152162
const options = {
153163
host: '192.160.21.34',

0 commit comments

Comments
 (0)