diff --git a/bin/newman.js b/bin/newman.js index 31affd9a6..93db6d059 100755 --- a/bin/newman.js +++ b/bin/newman.js @@ -43,6 +43,8 @@ program ' and whether to end the run with an error based on the optional modifier', util.cast.csvParse) .option('--ignore-redirects', 'Prevents Newman from automatically following 3XX redirect responses') .option('-x , --suppress-exit-code', 'Specify whether or not to override the default exit code for the current run') + .option('--suppress-request-errors [hostnames]', 'Specify the hostnames to be ignored on request errors', + util.cast.csvParse, []) .option('--silent', 'Prevents Newman from showing output to CLI') .option('--disable-unicode', 'Forces Unicode compliant symbols to be replaced by their plain text equivalents') .option('--color ', 'Enable/Disable colored output (auto|on|off)', util.cast.colorOptions, 'auto') diff --git a/lib/run/summary.js b/lib/run/summary.js index 0779fffee..40976be5d 100644 --- a/lib/run/summary.js +++ b/lib/run/summary.js @@ -38,6 +38,13 @@ RunSummary = function RunSummary (emitter, options) { */ globals: _.get(options, 'globals'), + /** + * Hostnames ignored during the run failures + * + * @type {VariableScope} + */ + suppressRequestErrors: _.get(options, 'suppressRequestErrors'), + /** * Holds information related to the run. */ @@ -370,6 +377,9 @@ _.assign(RunSummary, { // push failures sent from "before" events emitter.on(event, function (err, o) { if (!err) { return; } + else if (_.isEqual('Error', err.name) && _.includes(summary.suppressRequestErrors, err.hostname)) { + return; + } var item = o && o.item, source = event;