Skip to content

Commit

Permalink
test: cover triggerReport() failure case
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
cjihrig authored and BridgeAR committed Mar 14, 2019
1 parent 5a0ed0b commit 0f8d8d6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/report/test-report-triggerreport.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:'));
}

0 comments on commit 0f8d8d6

Please sign in to comment.