Skip to content

Commit ac3fb6d

Browse files
test: fix
1 parent 832fafb commit ac3fb6d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

test/cli/cli.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ describe('CLI', () => {
109109
it('--host 0.0.0.0 (IPv4)', (done) => {
110110
testBin('--host 0.0.0.0')
111111
.then((output) => {
112-
expect(normalizeStderr(output.stderr)).toMatchSnapshot('stderr');
112+
expect(normalizeStderr(output.stderr, { ipv6: true })).toMatchSnapshot(
113+
'stderr'
114+
);
113115

114116
done();
115117
})

test/helpers/test-bin.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,19 @@ function normalizeStderr(stderr, options = {}) {
6262

6363
if (options.ipv6 && !networkIPv6) {
6464
// Github Actions doesnt' support IPv6 on ubuntu in some cases
65-
normalizedStderr = normalizedStderr.replace(
66-
/\(IPv4\)/,
67-
'(IPv4), http://[<network-ip-v6>]:<port>/ (IPv6)'
65+
normalizedStderr = normalizedStderr.split('\n');
66+
67+
const ipv4MessageIndex = normalizedStderr.findIndex((item) =>
68+
/On Your Network \(IPv4\)/.test(item)
6869
);
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');
6978
}
7079

7180
return normalizedStderr;

0 commit comments

Comments
 (0)