newman
newman copied to clipboard
Feature: skip responses option for the JSON reporter
Fixes #1510
What does this PR do?
This implements the --reporter-json-skip-responses
in the JSON reporter (and consequently skipResponses
key when using the library). The primary aim is to reduce the huge files size that JSON reporter causes by dumping the response body into the JSON report.
Implementation
In the JSON reporter, if the related key was present then a deepClone of the run summary is made with lodash and response body is removed from that object. The resulting object was sent to be written into the exported file.
Testing
As there wasn't much testing being done for the JSON reporter I created 2 files in the test
directory namely test/cli/json-reporter-response.test.js
and test/library/json-reporter-responses.test.js
. They test the JSON reporter with and without the skip responses option passed.
Codecov Report
Merging #2277 into develop will increase coverage by
0.05%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## develop #2277 +/- ##
===========================================
+ Coverage 90.28% 90.33% +0.05%
===========================================
Files 26 26
Lines 1266 1273 +7
Branches 350 351 +1
===========================================
+ Hits 1143 1150 +7
Misses 123 123
Flag | Coverage Δ | |
---|---|---|
#cli | 83.56% <100.00%> (+0.10%) |
:arrow_up: |
#integration | 51.93% <0.00%> (-0.34%) |
:arrow_down: |
#library | 67.75% <100.00%> (+0.22%) |
:arrow_up: |
#unit | 76.14% <42.85%> (-0.22%) |
:arrow_down: |
Impacted Files | Coverage Δ | |
---|---|---|
lib/reporters/json/index.js | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 1c372d1...3da0250. Read the comment docs.
May I know which package this change will be available in?