-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
report: add --report-disable-network option
New option `--report-disable-network`, also available as `report.disableNetwork`, enables the user to disable networking interfaces in their diagnostic report. On some systems, this can cause the report to take minutes to generate so this option can be used to optimize that. fixes: #46060
- Loading branch information
1 parent
68885d5
commit 8341898
Showing
7 changed files
with
106 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
Check failure on line 1 in test/report/test-report-disable-network.js GitHub Actions / lint-js-and-md
|
||
const assert = require('node:assert/strict'); | ||
const { spawnSync } = require('node:child_process'); | ||
const tmpdir = require('../common/tmpdir'); | ||
const { describe, it, before } = require('node:test'); | ||
const fs = require('node:fs'); | ||
const helper = require('../common/report'); | ||
|
||
function validate(pid) { | ||
const reports = helper.findReports(pid, tmpdir.path); | ||
assert.equal(reports.length, 1); | ||
let report = fs.readFileSync(reports[0], { encoding: 'utf8' }); | ||
report = JSON.parse(report); | ||
assert.equal(report.header.networkInterfaces, undefined); | ||
fs.unlinkSync(reports[0]); | ||
} | ||
|
||
describe('report disable network option', () => { | ||
before(() => { | ||
tmpdir.refresh(); | ||
process.report.directory = tmpdir.path; | ||
}); | ||
|
||
it('should be configurable with --report-disable-network', () => { | ||
const args = ['--report-disable-network', '-e', 'process.report.writeReport()']; | ||
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); | ||
assert.equal(child.status, 0); | ||
assert.equal(child.signal, null); | ||
validate(child.pid); | ||
}); | ||
|
||
it('should be configurable with report.disableNetwork', () => { | ||
process.report.disableNetwork = true; | ||
process.report.writeReport(); | ||
validate(process.pid); | ||
}); | ||
}); |