Skip to content

Commit e8995d1

Browse files
cjihrigaddaleax
authored andcommitted
test: increase getReport() coverage
PR-URL: #26276 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 6d2a14d commit e8995d1

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

test/node-report/test-api-getreport.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,22 @@ const helper = require('../common/report');
88
common.expectWarning('ExperimentalWarning',
99
'report is an experimental feature. This feature could ' +
1010
'change at any time');
11-
helper.validateContent(process.report.getReport());
12-
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
11+
12+
{
13+
// Test with no arguments.
14+
helper.validateContent(process.report.getReport());
15+
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
16+
}
17+
18+
{
19+
// Test with an error argument.
20+
helper.validateContent(process.report.getReport(new Error('test error')));
21+
assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
22+
}
23+
24+
// Test with an invalid error argument.
25+
[null, 1, Symbol(), function() {}, 'foo'].forEach((error) => {
26+
common.expectsError(() => {
27+
process.report.getReport(error);
28+
}, { code: 'ERR_INVALID_ARG_TYPE' });
29+
});

0 commit comments

Comments
 (0)