Skip to content

Commit 1997a6e

Browse files
authored
fix: bonjour information log (#3223)
1 parent d830329 commit 1997a6e

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

lib/Server.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,11 @@ class Server {
735735
}
736736

737737
if (this.options.bonjour) {
738+
const protocol =
739+
this.options.bonjour.type || this.options.https ? 'https' : 'http';
740+
738741
this.logger.info(
739-
'Broadcasting "http" with subtype of "webpack" via ZeroConf DNS (Bonjour)'
742+
`Broadcasting "${protocol}" with subtype of "webpack" via ZeroConf DNS (Bonjour)`
740743
);
741744
}
742745

test/cli/__snapshots__/cli.test.js.snap.webpack4

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ exports[`CLI --bonjour 1`] = `
99
<i> [webpack-dev-server] Broadcasting \\"http\\" with subtype of \\"webpack\\" via ZeroConf DNS (Bonjour)"
1010
`;
1111

12+
exports[`CLI --bonjour and --https 1`] = `
13+
"<i> [webpack-dev-server] Project is running at:
14+
<i> [webpack-dev-server] Loopback: https://localhost:<port>/
15+
<i> [webpack-dev-server] On Your Network (IPv4): https://<network-ip-v4>:<port>/
16+
<i> [webpack-dev-server] On Your Network (IPv6): https://[<network-ip-v6>]:<port>/
17+
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory
18+
<i> [webpack-dev-server] Broadcasting \\"https\\" with subtype of \\"webpack\\" via ZeroConf DNS (Bonjour)"
19+
`;
20+
1221
exports[`CLI --history-api-fallback 1`] = `
1322
"<i> [webpack-dev-server] Project is running at:
1423
<i> [webpack-dev-server] Loopback: http://localhost:<port>/

test/cli/__snapshots__/cli.test.js.snap.webpack5

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ exports[`CLI --bonjour 1`] = `
99
<i> [webpack-dev-server] Broadcasting \\"http\\" with subtype of \\"webpack\\" via ZeroConf DNS (Bonjour)"
1010
`;
1111

12+
exports[`CLI --bonjour and --https 1`] = `
13+
"<i> [webpack-dev-server] Project is running at:
14+
<i> [webpack-dev-server] Loopback: https://localhost:<port>/
15+
<i> [webpack-dev-server] On Your Network (IPv4): https://<network-ip-v4>:<port>/
16+
<i> [webpack-dev-server] On Your Network (IPv6): https://[<network-ip-v6>]:<port>/
17+
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory
18+
<i> [webpack-dev-server] Broadcasting \\"https\\" with subtype of \\"webpack\\" via ZeroConf DNS (Bonjour)"
19+
`;
20+
1221
exports[`CLI --history-api-fallback 1`] = `
1322
"<i> [webpack-dev-server] Project is running at:
1423
<i> [webpack-dev-server] Loopback: http://localhost:<port>/

test/cli/cli.test.js

+13
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ describe('CLI', () => {
5656
.catch(done);
5757
});
5858

59+
it('--bonjour and --https', (done) => {
60+
testBin('--bonjour --https')
61+
.then((output) => {
62+
expect(output.exitCode).toEqual(0);
63+
expect(
64+
normalizeStderr(output.stderr, { ipv6: true, https: true })
65+
).toMatchSnapshot();
66+
67+
done();
68+
})
69+
.catch(done);
70+
});
71+
5972
it('--no-bonjour', (done) => {
6073
testBin('--no-bonjour')
6174
.then((output) => {

0 commit comments

Comments
 (0)