Skip to content

Commit

Permalink
test: increase getReport() coverage
Browse files Browse the repository at this point in the history
PR-URL: #26276
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig authored and addaleax committed Mar 1, 2019
1 parent 6d2a14d commit e8995d1
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/node-report/test-api-getreport.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,22 @@ const helper = require('../common/report');
common.expectWarning('ExperimentalWarning',
'report is an experimental feature. This feature could ' +
'change at any time');
helper.validateContent(process.report.getReport());
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);

{
// Test with no arguments.
helper.validateContent(process.report.getReport());
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
}

{
// Test with an error argument.
helper.validateContent(process.report.getReport(new Error('test error')));
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
}

// Test with an invalid error argument.
[null, 1, Symbol(), function() {}, 'foo'].forEach((error) => {
common.expectsError(() => {
process.report.getReport(error);
}, { code: 'ERR_INVALID_ARG_TYPE' });
});

0 comments on commit e8995d1

Please sign in to comment.