Simon Priet e69a613a37 feat: Created a mini nodeJS server with NewMan for testing without PostMan GUI.
This will mimic a run in a CD/CI environment or docker container.
2021-09-08 14:01:19 +02:00

23 lines
763 B
JavaScript

var _ = require('lodash');
/**
* Reporter that simply dumps the summary object to file (default: newman-run-report.json).
*
* @param {Object} newman - The collection run object, with event hooks for reporting run details.
* @param {Object} options - A set of collection run options.
* @param {String} options.export - The path to which the summary object must be written.
* @returns {*}
*/
module.exports = function (newman, options) {
newman.on('beforeDone', function (err, o) {
if (err) { return; }
newman.exports.push({
name: 'json-reporter',
default: 'newman-run-report.json',
path: options.export,
content: JSON.stringify(_.omit(o.summary, 'exports'), 0, 2)
});
});
};