File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ const logger = require ( 'webpack-log' ) ;
34const colors = require ( './colors' ) ;
45const runOpen = require ( './runOpen' ) ;
56
67// TODO: don't emit logs when webpack-dev-server is used via Node.js API
78function 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+
818 const contentBase = Array . isArray ( options . contentBase )
919 ? options . contentBase . join ( ', ' )
1020 : options . contentBase ;
Original file line number Diff line number Diff line change @@ -29,6 +29,22 @@ describe('CLI', () => {
2929 . catch ( done ) ;
3030 } ) ;
3131
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+
3248 it ( '--progress --profile' , ( done ) => {
3349 testBin ( '--progress --profile' )
3450 . then ( ( output ) => {
You can’t perform that action at this time.
0 commit comments