newman icon indicating copy to clipboard operation
newman copied to clipboard

Enhacement: Descriptive white space reporter error message

Open elit-altum opened this issue 5 years ago • 6 comments

  1. Newman Version (can be found via newman -v): 5.2.2
  2. OS details (type, version, and architecture): Windows 10 x64
  3. Are you using Newman as a library, or via the CLI? CLI
  4. Did you encounter this recently, or has this bug always been there: Not a bug
  5. Expected behaviour: More descriptive error message regarding not using white spaces between reporter names.
  6. Command / script used to run Newman: newman run examples/sample-collection.json -r cli, json

Though the documentation clearly mentions that while mentioning multiple reporter names the user should not use spaces after the commas, this can be looked over or forgotten while running newman. The error thrown in such a case does not point out this issue, which would enable quicker debugging. I would like to propose to add a line in the error statement to consider removing the white space before reporter names.

BEFORE image

AFTER image

I have a PR ready for this, I would like to discuss the exact wordings of the error messages before publishing the PR 🚀

elit-altum avatar Mar 15 '21 18:03 elit-altum

@shamasis Please have a look!

elit-altum avatar Mar 15 '21 18:03 elit-altum

Yeah definitely - this needs fixing. But is there a way we can completely get rid of this error scenario?

If it is a parsing error, can we not prune blank reporter options before passing the options further down the line in code?

I would rather attempt at fixing the root cause than suppress the symptom. Only and only if the root cause resolution is a massive endeavour is when I would go the message route for this case.

shamasis avatar Mar 15 '21 20:03 shamasis

Absolutely @shamasis, I tried to find the location where the parsing is happening but I wasn't able to locate it, is it a utils function? Could you please guide me in the right direction?

elit-altum avatar Mar 15 '21 20:03 elit-altum

I'm afraid that would be very difficult for me at the moment.

Try putting a breakpoint on the error and observe the stack trace.

Basic CLI parsing is done using an external library and then a bit of organising is done on top of it. Most of the code around that is in the cli bin js file.

shamasis avatar Mar 15 '21 21:03 shamasis

@shamasis Why this issue is still open I think @elit-altum solve the issue or not

ghost avatar Apr 01 '21 05:04 ghost

Yeah. Waiting for @codenirvana to review once. He's a bit stuck on some other releases. Let me see if I can bump it up.

shamasis avatar Apr 01 '21 07:04 shamasis