From 33fe892ec6a7ed1028d91e64379f7cafaf89cfc8 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 23 Feb 2019 09:27:36 -0500 Subject: [PATCH] test: increase triggerReport() coverage PR-URL: https://github.com/nodejs/node/pull/26268 Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- test/node-report/test-api-nohooks.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/node-report/test-api-nohooks.js b/test/node-report/test-api-nohooks.js index 6e7195d6ab84f7..4ac8f1a9a528d6 100644 --- a/test/node-report/test-api-nohooks.js +++ b/test/node-report/test-api-nohooks.js @@ -67,3 +67,17 @@ function validate() { helper.validate(filename); fs.unlinkSync(filename); } + +// Test with an invalid file argument. +[null, 1, Symbol(), function() {}].forEach((file) => { + common.expectsError(() => { + process.report.triggerReport(file); + }, { code: 'ERR_INVALID_ARG_TYPE' }); +}); + +// Test with an invalid error argument. +[null, 1, Symbol(), function() {}, 'foo'].forEach((error) => { + common.expectsError(() => { + process.report.triggerReport('file', error); + }, { code: 'ERR_INVALID_ARG_TYPE' }); +});