Skip to content

Commit 4c24022

Browse files
test: fix
1 parent a656846 commit 4c24022

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

test/cli/cli.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ describe('CLI', () => {
9797
it('--host and --port are unspecified', (done) => {
9898
testBin('')
9999
.then((output) => {
100-
expect(normalizeStderr(output.stderr)).toMatchSnapshot('stderr');
100+
expect(normalizeStderr(output.stderr, { ipv6: true })).toMatchSnapshot(
101+
'stderr'
102+
);
101103

102104
done();
103105
})
@@ -117,7 +119,9 @@ describe('CLI', () => {
117119
it('--host :: (IPv6)', (done) => {
118120
testBin('--host ::')
119121
.then((output) => {
120-
expect(normalizeStderr(output.stderr)).toMatchSnapshot('stderr');
122+
expect(normalizeStderr(output.stderr, { ipv6: true })).toMatchSnapshot(
123+
'stderr'
124+
);
121125

122126
done();
123127
})

test/helpers/test-bin.js

Lines changed: 9 additions & 1 deletion
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)