Skip to content

Commit

Permalink
feat() : case insensitive compare for truncate-body-output
Browse files Browse the repository at this point in the history
  • Loading branch information
Sid200026 committed Jan 24, 2022
1 parent b24e7f8 commit 518c643
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ such a scenario.
| `--reporter-cli-no-success-assertions` | This turns off the output for successful assertions as they happen. |
| `--reporter-cli-no-console` | This turns off the output of `console.log` (and other console calls) from collection's scripts. |
| `--reporter-cli-no-banner` | This turns off the `newman` banner shown at the beginning of each collection run. |
| `--reporter-cli-truncate-body-output <size in any unit>` | Specify the truncation size of body in verbose CLI output for requests and responses. You can pass inputs like `1KB`, `1024`, `2.5kb`, etc. By default, the truncation size is set to `2KB`. Pass `infinite` to remove any truncation size limit of verbose CLI output body. |
| `--reporter-cli-truncate-body-output <size in any unit>` | Specify the truncation size of body in verbose CLI output for requests and responses. You can pass inputs like `1KB`, `1024`, `2.5kb`, etc. By default, the truncation size is set to `2KB`. Pass `infinity` to remove any truncation size limit of verbose CLI output body. |

### JSON Reporter
The built-in JSON reporter is useful in producing a comprehensive output of the run summary. It takes the path to the
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ PostmanCLIReporter = function (emitter, reporterOptions, options) {

if (reporterOptions.truncateBodyOutput) {
// if infinite is passed to truncate-body-output
if (reporterOptions.truncateBodyOutput === 'infinite') {
if (reporterOptions.truncateBodyOutput.toLowerCase() === 'infinity') {
bodyClipSize = Number.POSITIVE_INFINITY;
}
else {
Expand Down
22 changes: 20 additions & 2 deletions test/cli/verbose.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,27 @@ describe('newman run --verbose', function () {
});
});

it('should log the entire output when infinite is passed to --truncate-body-output', function (done) {
it('should log the entire output when infinity is passed to --truncate-body-output', function (done) {
// eslint-disable-next-line max-len
exec('node ./bin/newman.js run test/fixtures/run/large-output-get-request.json --verbose --reporter-cli-truncate-body-output infinite', function (_code, stdout) {
exec('node ./bin/newman.js run test/fixtures/run/large-output-get-request.json --verbose --reporter-cli-truncate-body-output infinity', function (_code, stdout) {
_.forEach(endTags, function (str) {
expect(stdout).to.contain(str);
});

done();
});
});

// eslint-disable-next-line max-len
it('should log the entire output when infinity is passed to --truncate-body-output without considering case', function (done) {
// eslint-disable-next-line max-len
exec('node ./bin/newman.js run test/fixtures/run/large-output-get-request.json --verbose --reporter-cli-truncate-body-output InFiNiTy', function (_code, stdout) {
_.forEach(endTags, function (str) {
expect(stdout).to.contain(str);
});
});
// eslint-disable-next-line max-len
exec('node ./bin/newman.js run test/fixtures/run/large-output-get-request.json --verbose --reporter-cli-truncate-body-output INFINITY', function (_code, stdout) {
_.forEach(endTags, function (str) {
expect(stdout).to.contain(str);
});
Expand Down

0 comments on commit 518c643

Please sign in to comment.