mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: cover triggerReport() failure case
PR-URL: https://github.com/nodejs/node/pull/26524 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
@@ -106,3 +106,19 @@ function validate() {
|
||||
const report = child.stderr.toString().split('Node.js report completed')[0];
|
||||
helper.validateContent(report);
|
||||
}
|
||||
|
||||
{
|
||||
// Test the case where the report file cannot be opened.
|
||||
const reportDir = path.join(tmpdir.path, 'does', 'not', 'exist');
|
||||
const args = ['--experimental-report',
|
||||
`--diagnostic-report-directory=${reportDir}`,
|
||||
'-e',
|
||||
'process.report.triggerReport()'];
|
||||
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
|
||||
|
||||
assert.strictEqual(child.status, 0);
|
||||
assert.strictEqual(child.signal, null);
|
||||
assert.strictEqual(child.stdout.toString().trim(), '');
|
||||
const stderr = child.stderr.toString();
|
||||
assert(stderr.includes('Failed to open Node.js report file:'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user