Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/decathlon/newman-reporter-pullrequest-decorator
Newman reporter allowing to decorate pull request with postman collection results.
https://github.com/decathlon/newman-reporter-pullrequest-decorator
api github markdown newman postman pullrequest reporter test testing
Last synced: 4 months ago
JSON representation
Newman reporter allowing to decorate pull request with postman collection results.
- Host: GitHub
- URL: https://github.com/decathlon/newman-reporter-pullrequest-decorator
- Owner: Decathlon
- License: apache-2.0
- Created: 2021-06-18T14:54:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-02T00:44:27.000Z (over 1 year ago)
- Last Synced: 2024-10-24T04:30:28.900Z (4 months ago)
- Topics: api, github, markdown, newman, postman, pullrequest, reporter, test, testing
- Language: JavaScript
- Homepage:
- Size: 95.7 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: contributing.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
# newman-reporter-pullrequest-decorator
[](https://www.npmjs.com/package/@decathlon/newman-reporter-pullrequest-decorator)
[](https://github.com/Decathlon/newman-reporter-pullrequest-decorator/actions/workflows/build-test-publish-workflow.yml)
[](https://sonarcloud.io/dashboard?id=newman-reporter-pullrequest-decorator)
[](https://sonarcloud.io/dashboard?id=newman-reporter-pullrequest-decorator)## Description
Report [newman](https://github.com/postmanlabs/newman) collection results on an extra check in the Pull Request Checks tab.
If you need a way to export your Postman collection results into Github Pull Request, and you're using github workflow to handle your CI then you're in the right place !PullRequest's Check example :

## HIGHLIGHTED FEATURES
* Handle deep nested postman folder structure
* Group requests by their folder's name in the generated markdown## Getting Started
1. Install `newman`
2. Install `@decathlon/newman-reporter-pullrequest-decorator`
3. Run your github workflow and extract from it :
* GITHUB TOKEN from your running job. Usually, you can get it from ${{ secrets.GITHUB_TOKEN }}.### Prerequisites
1. `node` and `npm`
2. `newman` - `npm install -g newman`
3. A github token either from :
* your running github workflow provided as a secret (see above)
* your own specific Github App (see Notes what issue this option solves)---
## Installation
```console
npm install -g @decathlon/newman-reporter-pullrequest-decorator
```> Installation should be done globally if newman is installed globally, otherwise install without `-g` option
---
## Usage
Specify `-r @decathlon/pullrequest-decorator` option while running the collection
In non export mode (it means you actually want to update github pull request) :
```bash
newman run --environment= -r @decathlon/pullrequest-decorator \
--reporter-pullrequest-decorator-repo \
--reporter-pullrequest-decorator-token \
--reporter-pullrequest-decorator-checkname \
--reporter-pullrequest-decorator-refcommit
```In export mode :
```bash
newman run --environment= -r @decathlon/pullrequest-decorator \
--reporter-export
```### Options:
**Option** | **Remarks**
--- | ---
`--reporter-pullrequest-decorator-repo` | (Required) Usually you can get it from ${{ github.repository }}. It follows this pattern : "organization/repository"
`--reporter-pullrequest-decorator-token` | (Required) Github token : Usually you can get it from ${{ secrets.GITHUB_TOKEN }} while job is **running**. For more details : https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
`--reporter-pullrequest-decorator-checkname` | (Optional : Default `newman-check`) Name you want to give to the check name that will be created by the reporter. This parameter is useful if you want to wait for a specific check name to be completed inside your workflow. See, for example, the following github action : fountainhead/[email protected]
`--reporter-pullrequest-decorator-refcommit` | (Required) Long Commit hash. When you run this reporter from a Pull Request. You should use : ${{ github.event.pull_request.head.sha }}
`--reporter-debug` | (Optional : Default `false`) Reporter debug mode
`--suppress-exit-code` | (Optional) Ensure that asynchronous github API is called before reporter termination.
`--showOnlyFails` | (Optional : Default `false`) Show only failing assertions.
`--reporter-pullrequest-decorator-enablecomment` | (Optional) Boolean. Allows you to get a comment in your pull request containing the summary of the test result.---
## Notes:
PullRequest's check report can appear on the wrong check suite. This is due to a known github limitation. See here : https://github.community/t/specify-check-suite-when-creating-a-checkrun/118380
To solve this issue, you can use a token from your own created Github App (and not the one used in the github workflow) so this way, the check run will be automatically created on a specific check suite.---
## Development
- `npm pack`
- `npm i -g decathlon-newman-reporter-pullrequest-decorator..tgz`---