Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bin/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ module.exports = {
name: 'https',
type: Boolean,
description: 'Use HTTPS protocol.',
negatedDescription: 'Do not use HTTPS protocol.',
negative: true,
},
{
name: 'http2',
type: Boolean,
description: 'Use HTTP/2, must be used with HTTPS.',
negatedDescription: 'Do not use HTTP/2.',
negative: true,
},
{
name: 'bonjour',
Expand Down Expand Up @@ -105,11 +109,16 @@ module.exports = {
name: 'history-api-fallback',
type: Boolean,
description: 'Fallback to /index.html for Single Page Applications.',
negatedDescription:
'Do not fallback to /index.html for Single Page Applications.',
negative: true,
},
{
name: 'compress',
type: Boolean,
description: 'Enable gzip compression.',
negatedDescription: 'Disable gzip compression.',
negative: true,
},
{
name: 'public',
Expand Down
23 changes: 23 additions & 0 deletions test/cli/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ describe('CLI', () => {
.catch(done);
});

it('--no-https', (done) => {
testBin('--no-https')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(/https:\/\//.test(output.stderr)).toEqual(false);
expect(/http:\/\/localhost:[0-9]+/.test(output.stderr)).toEqual(true);
done();
})
.catch(done);
});

it('--history-api-fallback', (done) => {
testBin('--history-api-fallback --no-color')
.then((output) => {
Expand All @@ -67,6 +78,18 @@ describe('CLI', () => {
.catch(done);
});

it('--no-history-api-fallback', (done) => {
testBin('--no-history-api-fallback')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).not.toContain(
`404s will fallback to '/index.html'`
);
done();
})
.catch(done);
});

it('unspecified host and port', (done) => {
testBin('')
.then((output) => {
Expand Down