Skip to content

Commit 42f2d91

Browse files
test: update
1 parent 7501b24 commit 42f2d91

File tree

5 files changed

+19
-201
lines changed

5 files changed

+19
-201
lines changed

bin/cli-flags.js

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -295,26 +295,6 @@ module.exports = {
295295
simpleType: 'string',
296296
multiple: false,
297297
},
298-
'web-socket-server-type': {
299-
configs: [
300-
{
301-
type: 'enum',
302-
values: ['sockjs', 'ws'],
303-
multiple: false,
304-
description: 'Allows to set web socket server and options.',
305-
path: 'webSocketServer.type',
306-
},
307-
{
308-
type: 'string',
309-
multiple: false,
310-
description: 'Allows to set web socket server and options.',
311-
path: 'webSocketServer.type',
312-
},
313-
],
314-
description: 'Allows to set web socket server and options.',
315-
simpleType: 'string',
316-
multiple: false,
317-
},
318298
compress: {
319299
configs: [
320300
{
@@ -799,28 +779,6 @@ module.exports = {
799779
simpleType: 'string',
800780
multiple: true,
801781
},
802-
'watch-files-paths': {
803-
configs: [
804-
{
805-
type: 'string',
806-
multiple: true,
807-
description:
808-
'List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles',
809-
path: 'watchFiles[].paths',
810-
},
811-
{
812-
type: 'string',
813-
multiple: true,
814-
description:
815-
'List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles',
816-
path: 'watchFiles.paths[]',
817-
},
818-
],
819-
description:
820-
'List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles',
821-
simpleType: 'string',
822-
multiple: true,
823-
},
824782
'watch-files-reset': {
825783
configs: [
826784
{
@@ -836,19 +794,4 @@ module.exports = {
836794
simpleType: 'boolean',
837795
multiple: false,
838796
},
839-
'watch-files-paths-reset': {
840-
configs: [
841-
{
842-
type: 'reset',
843-
multiple: false,
844-
description:
845-
'Clear all items provided in configuration. List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles',
846-
path: 'watchFiles.paths',
847-
},
848-
],
849-
description:
850-
'Clear all items provided in configuration. List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles',
851-
simpleType: 'boolean',
852-
multiple: false,
853-
},
854797
};

lib/options.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@
5555
],
5656
"description": "Watch for files in static content directory."
5757
}
58-
},
59-
"required": ["directory"]
58+
}
6059
},
6160
"StaticString": {
6261
"type": "string",

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

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ Options:
7474
--client-web-socket-url-path <value> Tells clients connected to devServer to use the provided path to connect.
7575
--client-web-socket-url-protocol <value> Tells clients connected to devServer to use the provided protocol.
7676
--web-socket-server <value> Allows to set web socket server and options.
77-
--web-socket-server-type <value> Allows to set web socket server and options.
7877
--compress Enable gzip compression for everything served. https://webpack.js.org/configuration/dev-server/#devservercompress
7978
--no-compress Disable gzip compression.
8079
--history-api-fallback When using the HTML5 History API, the index.html page will likely have to be served in place of any 404 responses. https://webpack.js.org/configuration/dev-server/#devserverhistoryapifallback
@@ -116,9 +115,7 @@ Options:
116115
--static-reset Clear all items provided in configuration. It is possible to configure advanced options for serving static files from directory. See the Express documentation for the possible options. https://webpack.js.org/configuration/dev-server/#devserverstatic
117116
--static-public-path-reset Clear all items provided in configuration. The bundled files will be available in the browser under this path.
118117
--watch-files <value...> List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles
119-
--watch-files-paths <value...> List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles
120118
--watch-files-reset Clear all items provided in configuration. List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles
121-
--watch-files-paths-reset Clear all items provided in configuration. List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles
122119

123120
Global options:
124121
--color Enable colors on console.
@@ -336,23 +333,23 @@ exports[`CLI static option --static <value>: stderr 1`] = `
336333
<i> [webpack-dev-server] Content not from webpack is served from 'new-static' directory"
337334
`;
338335

339-
exports[`CLI static option --static --static-directory: stderr 1`] = `
336+
exports[`CLI static option --static: stderr 1`] = `
340337
"<i> [webpack-dev-server] Project is running at:
341338
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
342339
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
343340
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
344341
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
345342
`;
346343

347-
exports[`CLI static option --static: stderr 1`] = `
344+
exports[`CLI static option --static-directory: stderr 1`] = `
348345
"<i> [webpack-dev-server] Project is running at:
349346
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
350347
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
351348
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
352-
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
349+
<i> [webpack-dev-server] Content not from webpack is served from 'static-dir' directory"
353350
`;
354351

355-
exports[`CLI static option --static-directory: stderr 1`] = `
352+
exports[`CLI static option --static-directory: stderr 2`] = `
356353
"<i> [webpack-dev-server] Project is running at:
357354
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
358355
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
@@ -424,30 +421,6 @@ exports[`CLI watchFiles option --watch-files <value>: stderr 1`] = `
424421
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
425422
`;
426423

427-
exports[`CLI watchFiles option --watch-files-paths: stderr 1`] = `
428-
"<i> [webpack-dev-server] Project is running at:
429-
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
430-
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
431-
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
432-
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
433-
`;
434-
435-
exports[`CLI watchFiles option --watch-files-paths-reset: stderr 1`] = `
436-
"<i> [webpack-dev-server] Project is running at:
437-
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
438-
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
439-
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
440-
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
441-
`;
442-
443-
exports[`CLI watchFiles option --watch-files-reset --watch-files-paths <value>: stderr 1`] = `
444-
"<i> [webpack-dev-server] Project is running at:
445-
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
446-
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
447-
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
448-
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
449-
`;
450-
451424
exports[`CLI watchFiles option --watch-files-reset: stderr 1`] = `
452425
"<i> [webpack-dev-server] Project is running at:
453426
<i> [webpack-dev-server] Loopback: http://localhost:<port>/

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

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ Options:
7373
--client-web-socket-url-port <value> Tells clients connected to devServer to use the provided port.
7474
--client-web-socket-url-path <value> Tells clients connected to devServer to use the provided path to connect.
7575
--web-socket-server <value> Allows to set web socket server and options.
76-
--web-socket-server-type <value> Allows to set web socket server and options.
7776
--compress Enable gzip compression for everything served. https://webpack.js.org/configuration/dev-server/#devservercompress
7877
--no-compress Negative 'compress' option.
7978
--allowed-hosts <value...> Defines routes which are enabled by default, on by default and allows localhost/value from the 'host' option/value from the 'client.webSocketURL' option. https://webpack.js.org/configuration/dev-server/#devserverallowedhosts
@@ -117,9 +116,7 @@ Options:
117116
--static-reset Clear all items provided in configuration. It is possible to configure advanced options for serving static files from directory. See the Express documentation for the possible options. https://webpack.js.org/configuration/dev-server/#devserverstatic
118117
--static-public-path-reset Clear all items provided in configuration. The bundled files will be available in the browser under this path.
119118
--watch-files <value...> List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles
120-
--watch-files-paths <value...> List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles
121119
--watch-files-reset Clear all items provided in configuration. List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles
122-
--watch-files-paths-reset Clear all items provided in configuration. List of files to watch for file changes and serve. https://webpack.js.org/configuration/dev-server/#devserverwatchfiles
123120

124121
Global options:
125122
--color Enable colors on console.
@@ -337,23 +334,23 @@ exports[`CLI static option --static <value>: stderr 1`] = `
337334
<i> [webpack-dev-server] Content not from webpack is served from 'new-static' directory"
338335
`;
339336

340-
exports[`CLI static option --static --static-directory: stderr 1`] = `
337+
exports[`CLI static option --static: stderr 1`] = `
341338
"<i> [webpack-dev-server] Project is running at:
342339
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
343340
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
344341
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
345342
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
346343
`;
347344

348-
exports[`CLI static option --static: stderr 1`] = `
345+
exports[`CLI static option --static-directory: stderr 1`] = `
349346
"<i> [webpack-dev-server] Project is running at:
350347
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
351348
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
352349
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
353-
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
350+
<i> [webpack-dev-server] Content not from webpack is served from 'static-dir' directory"
354351
`;
355352

356-
exports[`CLI static option --static-directory: stderr 1`] = `
353+
exports[`CLI static option --static-directory: stderr 2`] = `
357354
"<i> [webpack-dev-server] Project is running at:
358355
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
359356
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
@@ -425,30 +422,6 @@ exports[`CLI watchFiles option --watch-files <value>: stderr 1`] = `
425422
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
426423
`;
427424

428-
exports[`CLI watchFiles option --watch-files-paths: stderr 1`] = `
429-
"<i> [webpack-dev-server] Project is running at:
430-
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
431-
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
432-
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
433-
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
434-
`;
435-
436-
exports[`CLI watchFiles option --watch-files-paths-reset: stderr 1`] = `
437-
"<i> [webpack-dev-server] Project is running at:
438-
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
439-
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
440-
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
441-
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
442-
`;
443-
444-
exports[`CLI watchFiles option --watch-files-reset --watch-files-paths <value>: stderr 1`] = `
445-
"<i> [webpack-dev-server] Project is running at:
446-
<i> [webpack-dev-server] Loopback: http://localhost:<port>/
447-
<i> [webpack-dev-server] On Your Network (IPv4): http://<network-ip-v4>:<port>/
448-
<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/
449-
<i> [webpack-dev-server] Content not from webpack is served from '<cwd>/public' directory"
450-
`;
451-
452425
exports[`CLI watchFiles option --watch-files-reset: stderr 1`] = `
453426
"<i> [webpack-dev-server] Project is running at:
454427
<i> [webpack-dev-server] Loopback: http://localhost:<port>/

test/cli/cli.test.js

Lines changed: 10 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ describe('CLI', () => {
2828
const normalizedCliOptions = {};
2929

3030
for (const [name, options] of Object.entries(cliOptions)) {
31-
delete options.processor;
3231
// Only webpack-cli supports it
3332
// TODO send PR to webpack
3433
delete options.negatedDescription;
@@ -401,24 +400,6 @@ describe('CLI', () => {
401400
})
402401
.catch(done);
403402
});
404-
405-
it('--web-socket-server-type sockjs', (done) => {
406-
testBin('--web-socket-server-type sockjs')
407-
.then((output) => {
408-
expect(output.exitCode).toEqual(0);
409-
done();
410-
})
411-
.catch(done);
412-
});
413-
414-
it('--web-socket-server-type ws', (done) => {
415-
testBin('--web-socket-server-type ws')
416-
.then((output) => {
417-
expect(output.exitCode).toEqual(0);
418-
done();
419-
})
420-
.catch(done);
421-
});
422403
});
423404

424405
describe('http2 option', () => {
@@ -492,7 +473,7 @@ describe('CLI', () => {
492473
const passphrase = 'webpack-dev-server';
493474

494475
testBin(
495-
`--https --https-key ${key} --https-pfx ${pfxFile} --https-passphrase ${passphrase} --https-cert ${cert}`
476+
`--https-key ${key} --https-pfx ${pfxFile} --https-passphrase ${passphrase} --https-cert ${cert}`
496477
)
497478
.then((output) => {
498479
expect(output.exitCode).toEqual(0);
@@ -889,8 +870,8 @@ describe('CLI', () => {
889870
.catch(done);
890871
});
891872

892-
it(' --open --open-target index.html', (done) => {
893-
testBin('--open --open-target index.html')
873+
it('--open-target index.html', (done) => {
874+
testBin('--open-target index.html')
894875
.then((output) => {
895876
expect(output.exitCode).toEqual(0);
896877
done();
@@ -925,18 +906,18 @@ describe('CLI', () => {
925906
.catch(done);
926907
});
927908

928-
it('--open --open-target /index.html --open-app google-chrome', (done) => {
929-
testBin('--open --open-target /index.html --open-app google-chrome')
909+
it('--open-target /index.html --open-app google-chrome', (done) => {
910+
testBin('--open-target /index.html --open-app google-chrome')
930911
.then((output) => {
931912
expect(output.exitCode).toEqual(0);
932913
done();
933914
})
934915
.catch(done);
935916
});
936917

937-
it('--open --open-target /index.html --open-app google-chrome --open-app-name google-chrome', (done) => {
918+
it('--open-target /index.html --open-app google-chrome --open-app-name google-chrome', (done) => {
938919
testBin(
939-
'--open --open-target /index.html --open-app google-chrome --open-app-name google-chrome'
920+
'--open-target /index.html --open-app google-chrome --open-app-name google-chrome'
940921
)
941922
.then((output) => {
942923
expect(output.exitCode).toEqual(0);
@@ -1039,8 +1020,8 @@ describe('CLI', () => {
10391020
.catch(done);
10401021
});
10411022

1042-
it('--static --static-directory', (done) => {
1043-
testBin('--static --static-directory static-dir')
1023+
it('--static-directory', (done) => {
1024+
testBin('--static-directory static-dir')
10441025
.then((output) => {
10451026
expect(output.exitCode).toEqual(0);
10461027
expect(
@@ -1112,7 +1093,7 @@ describe('CLI', () => {
11121093
});
11131094

11141095
it('--no-static-watch', (done) => {
1115-
testBin('--static-watch')
1096+
testBin('--no-static-watch')
11161097
.then((output) => {
11171098
expect(output.exitCode).toEqual(0);
11181099
expect(
@@ -1181,57 +1162,6 @@ describe('CLI', () => {
11811162
})
11821163
.catch(done);
11831164
});
1184-
1185-
it('--watch-files-reset --watch-files-paths <value>', (done) => {
1186-
const watchDirectory = path.resolve(
1187-
__dirname,
1188-
'../fixtures/static/static'
1189-
);
1190-
1191-
testBin(`--watch-files-reset --watch-files-paths ${watchDirectory}`)
1192-
.then((output) => {
1193-
expect(output.exitCode).toEqual(0);
1194-
expect(
1195-
normalizeStderr(output.stderr, { ipv6: true })
1196-
).toMatchSnapshot('stderr');
1197-
done();
1198-
})
1199-
.catch(done);
1200-
});
1201-
1202-
it('--watch-files-paths', (done) => {
1203-
const watchDirectory = path.resolve(
1204-
__dirname,
1205-
'../fixtures/static/static'
1206-
);
1207-
1208-
testBin(`--watch-files-paths ${watchDirectory}`)
1209-
.then((output) => {
1210-
expect(output.exitCode).toEqual(0);
1211-
expect(
1212-
normalizeStderr(output.stderr, { ipv6: true })
1213-
).toMatchSnapshot('stderr');
1214-
done();
1215-
})
1216-
.catch(done);
1217-
});
1218-
1219-
it('--watch-files-paths-reset', (done) => {
1220-
const watchDirectory = path.resolve(
1221-
__dirname,
1222-
'../fixtures/static/static'
1223-
);
1224-
1225-
testBin(`--watch-files-paths-reset --watch-files-paths ${watchDirectory}`)
1226-
.then((output) => {
1227-
expect(output.exitCode).toEqual(0);
1228-
expect(
1229-
normalizeStderr(output.stderr, { ipv6: true })
1230-
).toMatchSnapshot('stderr');
1231-
done();
1232-
})
1233-
.catch(done);
1234-
});
12351165
});
12361166

12371167
it('should accept the promise function of webpack.config.js', (done) => {

0 commit comments

Comments
 (0)