Skip to content

Commit 93498da

Browse files
committed
test: more
1 parent cf55101 commit 93498da

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ exports[`CLI --no-https-request-cert 1`] = `
164164
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
165165
`;
166166

167+
exports[`CLI https options 1`] = `
168+
"<i> [webpack-dev-server] Project is running at:
169+
<i> [webpack-dev-server] Loopback: https://localhost:<port>/
170+
<i> [webpack-dev-server] On Your Network (IPv4): https://<network-ip-v4>:<port>/
171+
<i> [webpack-dev-server] On Your Network (IPv6): https://[<network-ip-v6>]:<port>/
172+
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
173+
`;
174+
167175
exports[`CLI should generate correct cli flags 1`] = `
168176
"Usage: webpack serve|s [entries...] [options]
169177

test/cli/cli.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ const { testBin, normalizeStderr } = require('../helpers/test-bin');
99
const localIPv4 = internalIp.v4.sync();
1010
const localIPv6 = internalIp.v6.sync();
1111

12+
const httpsCertificateDirectory = path.resolve(
13+
__dirname,
14+
'../fixtures/https-certificate'
15+
);
16+
1217
describe('CLI', () => {
1318
it('--hot', (done) => {
1419
testBin('--hot --stats=detailed')
@@ -139,6 +144,27 @@ describe('CLI', () => {
139144
.catch(done);
140145
});
141146

147+
it('https options', (done) => {
148+
const pfxFile = path.join(httpsCertificateDirectory, 'server.pfx');
149+
const key = path.join(httpsCertificateDirectory, 'server.key');
150+
const cert = path.join(httpsCertificateDirectory, 'server.crt');
151+
const cacert = path.join(httpsCertificateDirectory, 'ca.pem');
152+
const passphrase = 'webpack-dev-server';
153+
154+
testBin(
155+
`--https-key ${key} --https-pfx ${pfxFile} --https-passphrase ${passphrase} --https-cert ${cert} --https-cacert ${cacert}`
156+
)
157+
.then((output) => {
158+
expect(output.exitCode).toEqual(0);
159+
expect(
160+
normalizeStderr(output.stderr, { ipv6: true, https: true })
161+
).toMatchSnapshot();
162+
163+
done();
164+
})
165+
.catch(done);
166+
});
167+
142168
it('--https-request-cert', (done) => {
143169
testBin('--https-request-cert')
144170
.then((output) => {

0 commit comments

Comments
 (0)