From 76ae0ac6c6a1efba5dce9fb525e07f966fc79a55 Mon Sep 17 00:00:00 2001 From: zhangyuang Date: Sat, 13 Apr 2019 23:14:10 +0800 Subject: [PATCH 1/2] feat: add sockPath argv to options --- lib/utils/createConfig.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/utils/createConfig.js b/lib/utils/createConfig.js index 16ff397637..a696aacdb5 100644 --- a/lib/utils/createConfig.js +++ b/lib/utils/createConfig.js @@ -30,6 +30,10 @@ function createConfig(config, argv, { port }) { options.socket = argv.socket; } + if (argv.sockPath) { + options.sockPath = argv.sockPath; + } + if (argv.progress) { options.progress = argv.progress; } From ac92c18e8dd5c9835ae79da2028125d311c25a84 Mon Sep 17 00:00:00 2001 From: zhangyuang Date: Wed, 17 Apr 2019 09:38:46 +0800 Subject: [PATCH 2/2] feat: add test --- test/cli.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/cli.test.js b/test/cli.test.js index 5d54f39447..83244797b9 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -71,6 +71,17 @@ describe('CLI', () => { .catch(done); }); + it('--sockPath', (done) => { + runDevServer('--sockPath /mysockPath') + .then((output) => { + expect( + output.stdout.includes('http://localhost&sockPath=/mysockPath') + ).toEqual(true); + done(); + }) + .catch(done); + }); + it('should exit the process when SIGINT is detected', (done) => { const cliPath = path.resolve(__dirname, '../bin/webpack-dev-server.js'); const examplePath = path.resolve(__dirname, '../examples/cli/public');