Guest User

Untitled

a guest
Oct 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. var CurlReporter;
  2.  
  3. /**
  4. * Simple reporter that generates a curl statement
  5. *
  6. * @param {Object} newman - A run object with event handler specification methods.
  7. * @param {Function} newman.on - An event setter method that provides hooks for reporting collection run progress.
  8. * @param {Object} reporterOptions - A set of reporter specific run options.
  9. * @param {Object} options - A set of generic collection run options.
  10. * @returns {*}
  11. */
  12. CurlReporter = function (newman, reporterOptions, options) {
  13. if (options.silent || reporterOptions.silent) {
  14. return;
  15. }
  16.  
  17. newman.on('start', function (err, o) {
  18. if (err) { return; }
  19. // Can start opening a file here
  20. });
  21.  
  22. newman.on('beforeRequest', function (err, o) {
  23. if (err || !o.request) { return; }
  24. console.log('curl -X %s %s ', o.request.method, o.request.url.toString());
  25. });
  26.  
  27. newman.on('done', function () {
  28. // Can closing the file here
  29. });
  30. };
  31.  
  32. CurlReporter.prototype.dominant = true;
  33. module.exports = CurlReporter;
Add Comment
Please, Sign In to add comment