Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from phanimohan/fix-cli-reports
Browse files Browse the repository at this point in the history
fix-cli-reports: Reporting request headers when cli set to true
  • Loading branch information
Phani Mohan. Y authored Jun 4, 2018
2 parents 3ed87ff + 21ed225 commit 6883302
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# Basic text reporter for Newman

## Installation
Run `npm install --save newman-reporter-text`
Run `npm install --save newman-reporter-basicText@git+ssh://git@github.com:nbcdotcom/newman-reporter-basicText.git`

## Usage
In order to use this custom reporter, simply add 'text' to the list of reporters.
In order to use this custom reporter, simply add 'basicText' to the list of reporters.

### Options
This text reporter also accepts three options.
* export: If you'd like newman to output the results of the collection to a file, enter the file name under the 'export' property.
* cli: If you'd like newman to output the results of the collection to stdout, set the 'cli' property as 'true' (string not bool).
* rolling: If you'd like newman to output the results to a new file based on the current day set this property to 'true'

Note that you do not have to do `require('newman-reporter-text')` anywhere as newman will automatically require the package when the collection is run.
Note that you do not have to do `require('newman-reporter-basicText')` anywhere as newman will automatically require the package when the collection is run.

```
newman.run({
collection: require('./tests.postman_collection.json'),
reporters: 'text',
reporters: 'basicText',
reporter: {
'text': {
'basicText': {
// Take output and save it to file
export: `./logs/${startTime}.txt`,
// Output to rolling file based on current day
rolling: 'ture',
rolling: 'true',
// Output the results to stdout
cli: 'true'
}
Expand All @@ -34,7 +34,7 @@ newman.run({
```

```
newman run ./tests.postman_collection.json --reporter text --reporter-text-export './logs/output.txt' --reporter-text-rolling 'true' --reporter-text-cli 'true'
newman run ./tests.postman_collection.json --reporter basicText --reporter-basicText-export './logs/output.txt' --reporter-basicText-rolling 'true' --reporter-basicText-cli 'true'
```

## Example Output
Expand Down
2 changes: 1 addition & 1 deletion newman-reporter-basicText.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function(newman, reporterOptions) {
if (err) {
console.log(JSON.stringify(err));
}
if (o) {
if (o && useCli) {
console.log(JSON.stringify(o));
}
});
Expand Down

0 comments on commit 6883302

Please sign in to comment.