diff --git a/test/report/test-report-exclude-network.js b/test/report/test-report-exclude-network.js index c5e50135482f1a..d4bd6b117f6ebd 100644 --- a/test/report/test-report-exclude-network.js +++ b/test/report/test-report-exclude-network.js @@ -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'); + }); });