Added flag to set verbose output size limit for newman run
Flag for Verbose Output Size Limit
Previously, the output limit when the verbose flag was set was 2KB or 2048 bytes which were hardcoded in the codebase. The main argument that can be made for hardcoding the limit to 2KB is large data streams can crash the terminal. However, this limit is unfair in cases when the output size is just beyond the 2KB size limit. Moreover in cases when you want to pipe the output of newman run to a file, setting a size limit doesn't make sense and moreover, the terminal won't crash.
This PR adds two new flags under --reporter-cli-*
- --reporter-cli-verbose-output-limit
: Specify the truncation size of body in verbose CLI output for requests and responses - --reporter-cli-no-verbose-output-limit : This removes any truncation size limit of body in verbose CLI output for requests and responses
Syntax
newman run <collection> --verbose --reporter-cli-verbose-output-limit <size in any unit>
newman run <collection> --verbose --reporter-cli-no-verbose-output-limit
Changes
- [x] Modified cli core logic
- [x] Added tests
- [x] Updated Documentation
Closes #2845
Codecov Report
Merging #2883 (a66db04) into develop (90f4449) will increase coverage by
0.59%. The diff coverage is100.00%.
@@ Coverage Diff @@
## develop #2883 +/- ##
===========================================
+ Coverage 90.96% 91.55% +0.59%
===========================================
Files 21 21
Lines 1151 1161 +10
Branches 349 352 +3
===========================================
+ Hits 1047 1063 +16
+ Misses 104 98 -6
| Flag | Coverage Δ | |
|---|---|---|
| cli | 82.77% <100.00%> (+0.67%) |
:arrow_up: |
| integration | 40.74% <7.14%> (-0.27%) |
:arrow_down: |
| library | 58.13% <7.14%> (-0.42%) |
:arrow_down: |
| unit | 74.50% <7.14%> (-0.57%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| bin/util.js | 100.00% <ø> (ø) |
|
| lib/reporters/cli/index.js | 87.43% <100.00%> (+3.83%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 90f4449...a66db04. Read the comment docs.
@shamasis can you provide me with some additional feedback so that I can continue working on this?
Hey @shamasis, @codenirvana @coditva, I have updated this PR with the necessary changes.
Currently there are 2 flags,
newman run <collection> --verbose --reporter-cli-verbose-output-limit <size in any unit>newman run <collection> --verbose --reporter-cli-no-verbose-output-limit
The --reporter-cli-verbose-output-limit uses bytes to convert string input to bytes. In case of any invalid input, a warning is shown and a fallback size of 2KB is used.
@shamasis, I have simplified the implementation by using a single flag.
newman run <collection> --verbose --reporter-cli-truncate-body-output <size in any unit>. You can pass infinite to remove any truncation limit.
@shamasis, I have simplified the implementation by using a single flag.
newman run <collection> --verbose --reporter-cli-truncate-body-output <size in any unit>. You can pass infinite to remove any truncation limit.
I think this is ready for approval. Feature now looks cool.
I've marked it as approved, but there's one tiny comment to resolve for you.
Hello, this improvement is waiting for 1 year already, is there an eta when it'll be published or is there an alternative to avoid output limiting?
I would love to have this
Hello,
Is there any forecast to have this option published on newman? That's really something that will help a lot everyone, have the full request / response body written into a log. We work with images base64 inside the body and is impossible to check if everything was sent as expected
Eduardo