File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ const logger = require ( 'webpack-log' ) ;
3
4
const colors = require ( './colors' ) ;
4
5
const runOpen = require ( './runOpen' ) ;
5
6
6
7
// TODO: don't emit logs when webpack-dev-server is used via Node.js API
7
8
function status ( uri , options , log , useColor ) {
9
+ if ( options . quiet === true ) {
10
+ // Add temporary logger to output just the status of the dev server
11
+ log = logger ( {
12
+ name : 'wds' ,
13
+ level : 'info' ,
14
+ timestamp : options . logTime ,
15
+ } ) ;
16
+ }
17
+
8
18
const contentBase = Array . isArray ( options . contentBase )
9
19
? options . contentBase . join ( ', ' )
10
20
: options . contentBase ;
Original file line number Diff line number Diff line change @@ -29,6 +29,22 @@ describe('CLI', () => {
29
29
. catch ( done ) ;
30
30
} ) ;
31
31
32
+ it ( '--quiet' , async ( done ) => {
33
+ const output = await testBin ( '--quiet' ) ;
34
+ expect ( output . code ) . toEqual ( 0 ) ;
35
+ expect ( output . stdout . split ( '\n' ) . length === 3 ) . toBe ( true ) ;
36
+ expect (
37
+ output . stdout . includes ( 'Project is running at http://localhost:8080/' )
38
+ ) . toBe ( true ) ;
39
+ expect ( output . stdout . includes ( 'webpack output is served from /' ) ) . toBe (
40
+ true
41
+ ) ;
42
+ expect (
43
+ output . stdout . includes ( 'Content not from webpack is served from' )
44
+ ) . toBe ( true ) ;
45
+ done ( ) ;
46
+ } ) ;
47
+
32
48
it ( '--progress --profile' , ( done ) => {
33
49
testBin ( '--progress --profile' )
34
50
. then ( ( output ) => {
You can’t perform that action at this time.
0 commit comments