Skip to content

Commit b496245

Browse files
test: fix
1 parent d5a57e8 commit b496245

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

test/cli/cli.test.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ describe('CLI', () => {
9696
it('--host and --port are unspecified', (done) => {
9797
testBin('')
9898
.then((output) => {
99-
expect(normalizeStderr(output.stderr)).toMatchSnapshot('stderr');
99+
expect(normalizeStderr(output.stderr, { ipv6: true })).toMatchSnapshot(
100+
'stderr'
101+
);
100102

101103
done();
102104
})
@@ -116,7 +118,9 @@ describe('CLI', () => {
116118
it('--host :: (IPv6)', (done) => {
117119
testBin('--host ::')
118120
.then((output) => {
119-
expect(normalizeStderr(output.stderr)).toMatchSnapshot('stderr');
121+
expect(normalizeStderr(output.stderr, { ipv6: true })).toMatchSnapshot(
122+
'stderr'
123+
);
120124

121125
done();
122126
})

test/helpers/test-bin.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function testBin(testArgs, configPath) {
3232
return execa('node', args, { cwd, env, timeout: 10000 });
3333
}
3434

35-
function normalizeStderr(stderr) {
35+
function normalizeStderr(stderr, options = {}) {
3636
let normalizedStderr = stderr;
3737

3838
normalizedStderr = normalizedStderr.replace(
@@ -60,6 +60,14 @@ function normalizeStderr(stderr) {
6060

6161
normalizedStderr = normalizedStderr.replace(/:[0-9]+\//g, ':<port>/');
6262

63+
if (options.ipv6 && !networkIPv6) {
64+
// Github Actions doesnt' support IPv6 on ubuntu in some cases
65+
normalizedStderr = normalizedStderr.replace(
66+
/\(IPv4\)/,
67+
'(IPv4), http://[<network-ip-v6>]:<port>/ (IPv6)'
68+
);
69+
}
70+
6371
return normalizedStderr;
6472
}
6573

0 commit comments

Comments
 (0)