Skip to content

test: publicPath logs #2912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2020
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
70 changes: 35 additions & 35 deletions bin/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,48 @@ const BASIC_GROUP = 'Basic options:';
module.exports = {
devServer: [
{
name: 'bonjour',
type: Boolean,
describe: 'Broadcasts the server via ZeroConf networking on start',
name: 'host',
type: String,
describe: 'The hostname/ip address the server will bind to',
group: CONNECTION_GROUP,
},
{
name: 'port',
type: Number,
describe: 'The port',
group: CONNECTION_GROUP,
},
{
name: 'static',
type: [String, Boolean],
describe: 'A directory to serve static content from.',
group: RESPONSE_GROUP,
multiple: true,
negative: true,
},
{
name: 'live-reload',
type: Boolean,
describe: 'Enables/Disables live reloading on changing files',
negative: true,
},
{
name: 'https',
type: Boolean,
group: SSL_GROUP,
describe: 'HTTPS',
},
{
name: 'http2',
type: Boolean,
group: SSL_GROUP,
describe: 'HTTP/2, must be used with HTTPS',
},
{
name: 'bonjour',
type: Boolean,
describe: 'Broadcasts the server via ZeroConf networking on start',
},
{
name: 'client-progress',
type: Boolean,
Expand Down Expand Up @@ -83,26 +115,6 @@ module.exports = {
delete opts.clientLogging;
},
},
{
name: 'https',
type: Boolean,
group: SSL_GROUP,
describe: 'HTTPS',
},
{
name: 'http2',
type: Boolean,
group: SSL_GROUP,
describe: 'HTTP/2, must be used with HTTPS',
},
{
name: 'static',
type: [String, Boolean],
describe: 'A directory to serve static content from.',
group: RESPONSE_GROUP,
multiple: true,
negative: true,
},
{
name: 'history-api-fallback',
type: Boolean,
Expand All @@ -115,24 +127,12 @@ module.exports = {
describe: 'Enable gzip compression',
group: RESPONSE_GROUP,
},
{
name: 'port',
type: Number,
describe: 'The port',
group: CONNECTION_GROUP,
},
{
name: 'public',
type: String,
describe: 'The public hostname/ip address of the server',
group: CONNECTION_GROUP,
},
{
name: 'host',
type: String,
describe: 'The hostname/ip address the server will bind to',
group: CONNECTION_GROUP,
},
{
name: 'firewall',
type: String,
Expand Down
19 changes: 19 additions & 0 deletions test/cli/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,25 @@ runCLITest('CLI', () => {
.catch(done);
});

it('should log public path', (done) => {
testBin(
false,
resolve(__dirname, '../fixtures/dev-public-path/webpack.config.js')
)
.then((output) => {
expect(output.exitCode).toEqual(0);
done();
})
.catch((err) => {
// for windows
expect(err.stderr).toContain(
"webpack output is served from '/foo/bar' URL"
);
expect(err.stderr).toContain('Compiled successfully.');
done();
});
});

it('should accept the promise function of webpack.config.js', (done) => {
testBin(
false,
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/dev-public-path/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

console.log('i am foo!');
13 changes: 13 additions & 0 deletions test/fixtures/dev-public-path/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

const { join } = require('path');

module.exports = {
mode: 'development',
entry: join(__dirname, 'foo.js'),
devServer: {
dev: {
publicPath: '/foo/bar',
},
},
};