From 3876b0f5eba72db64f18228b9d33abbc6abe2656 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Fri, 12 Nov 2021 15:50:17 +0100 Subject: [PATCH] Support disabling reporter in programmatic API --- README.md | 2 ++ index.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 995158c..abcaed9 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,8 @@ hallmark --report json hallmark --report [ json --pretty ] ``` +In the programmatic API of `hallmark` (which is not documented yet) the reporter can also be disabled by passing `{ report: false }` as the options. + ## Install With [npm](https://npmjs.org) do: diff --git a/index.js b/index.js index 32d978b..2480019 100644 --- a/index.js +++ b/index.js @@ -31,7 +31,9 @@ function hallmark (options, callback) { let reporter let reporterOptions - if (options.report) { + if (options.report === false) { + reporter = function noop () {} + } else if (options.report) { // Only take one --report option reporter = [].concat(options.report)[0]