Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel committed Oct 30, 2024
1 parent 4189280 commit bd8b10c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/report/test-report-exclude-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,22 @@ describe('report exclude network option', () => {
const report = process.report.getReport();
assert.strictEqual(report.header.networkInterfaces, undefined);
});

it('should not do DNS queries in libuv if exclude network', async () => {
await fetch('http://localhost');

process.report.excludeNetwork = false;
let report = process.report.getReport();
let tcp = report.libuv.find((uv) => uv.type === 'tcp');
assert.notEqual(tcp, null);
assert.strictEqual(tcp.localEndpoint.host, 'localhost');
assert.strictEqual(tcp.remoteEndpoint.host, 'localhost');

process.report.excludeNetwork = true;
report = process.report.getReport();
tcp = report.libuv.find((uv) => uv.type === 'tcp');
assert.notEqual(tcp, null);
assert.strictEqual(tcp.localEndpoint.host, '127.0.0.1');
assert.strictEqual(tcp.remoteEndpoint.host, '127.0.0.1');
});
});

0 comments on commit bd8b10c

Please sign in to comment.