Skip to content

Commit 9e8118a

Browse files
improve error reporting
1 parent a96660c commit 9e8118a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

packages/compass-e2e-tests/tests/no-network-traffic.test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('networkTraffic: false / Isolated Edition', function () {
5656
const wrapperFile = path.join(tmpdir, 'wrap.sh');
5757
await fs.writeFile(
5858
wrapperFile,
59-
`#!/bin/bash\nulimit -c 0; exec strace -f -e connect -qqq -o '${outfile}' '${binary}' "$@"\n`
59+
`#!/bin/bash\nulimit -c 0; exec strace -f -e connect -tt -o '${outfile}' '${binary}' "$@"\n`
6060
);
6161
await fs.chmod(wrapperFile, 0o755);
6262
return wrapperFile;
@@ -115,12 +115,15 @@ describe('networkTraffic: false / Isolated Edition', function () {
115115
);
116116
}
117117

118-
if (
119-
[...connectTargets].some(
120-
(target) => !/^127.0.0.1:|^\[::1\]:/.test(target)
121-
)
122-
) {
123-
throw new Error(`Connected to unexpected host! ${[...connectTargets]}`);
118+
const unexpectedHosts = [...connectTargets].filter(
119+
(target) => !/^127.0.0.1:|^\[::1\]:/.test(target)
120+
);
121+
if (unexpectedHosts.length > 0) {
122+
throw new Error(
123+
`Connected to unexpected host! ${[
124+
...unexpectedHosts,
125+
]}. Here is the strace log:\n ${straceLog}`
126+
);
124127
}
125128
if (![...connectTargets].some((target) => /:27091$/.test(target))) {
126129
throw new Error(

0 commit comments

Comments
 (0)