diff options
author | cjihrig <cjihrig@gmail.com> | 2019-02-23 09:52:03 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2019-02-26 18:05:38 -0500 |
commit | 9d44950539e51461ede6fc04b63fb97d033f5468 (patch) | |
tree | 377bd5717d05fd158cf1c01630f0ee349bd939bf /test | |
parent | fe8c1f69f2646a7bcc9c3a9b105d4ffdebd7d1f2 (diff) | |
download | android-node-v8-9d44950539e51461ede6fc04b63fb97d033f5468.tar.gz android-node-v8-9d44950539e51461ede6fc04b63fb97d033f5468.tar.bz2 android-node-v8-9d44950539e51461ede6fc04b63fb97d033f5468.zip |
test: increase getReport() coverage
PR-URL: https://github.com/nodejs/node/pull/26276
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/node-report/test-api-getreport.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/node-report/test-api-getreport.js b/test/node-report/test-api-getreport.js index 780a5147b3..9f40e61c2e 100644 --- a/test/node-report/test-api-getreport.js +++ b/test/node-report/test-api-getreport.js @@ -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' }); +}); |