File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,9 @@ describe('CLI', () => {
109
109
it ( '--host 0.0.0.0 (IPv4)' , ( done ) => {
110
110
testBin ( '--host 0.0.0.0' )
111
111
. then ( ( output ) => {
112
- expect ( normalizeStderr ( output . stderr ) ) . toMatchSnapshot ( 'stderr' ) ;
112
+ expect ( normalizeStderr ( output . stderr , { ipv6 : true } ) ) . toMatchSnapshot (
113
+ 'stderr'
114
+ ) ;
113
115
114
116
done ( ) ;
115
117
} )
Original file line number Diff line number Diff line change @@ -62,10 +62,19 @@ function normalizeStderr(stderr, options = {}) {
62
62
63
63
if ( options . ipv6 && ! networkIPv6 ) {
64
64
// Github Actions doesnt' support IPv6 on ubuntu in some cases
65
- normalizedStderr = normalizedStderr . replace (
66
- / \( I P v 4 \) / ,
67
- '(IPv4), http://[<network-ip-v6>]:<port>/ (IPv6)'
65
+ normalizedStderr = normalizedStderr . split ( '\n' ) ;
66
+
67
+ const ipv4MessageIndex = normalizedStderr . findIndex ( ( item ) =>
68
+ / O n Y o u r N e t w o r k \( I P v 4 \) / . test ( item )
68
69
) ;
70
+
71
+ normalizedStderr . splice (
72
+ ipv4MessageIndex + 1 ,
73
+ 0 ,
74
+ '<i> [webpack-dev-server] On Your Network (IPv6): http://[<network-ip-v6>]:<port>/'
75
+ ) ;
76
+
77
+ normalizedStderr = normalizedStderr . join ( '\n' ) ;
69
78
}
70
79
71
80
return normalizedStderr ;
You can’t perform that action at this time.
0 commit comments