Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@decathlon/newman-reporter-pullrequest-decorator

Package Overview
Dependencies
Maintainers
4
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@decathlon/newman-reporter-pullrequest-decorator - npm Package Compare versions

Comparing version 0.0.24 to 0.0.25

2

CHANGELOG.md

@@ -5,2 +5,4 @@ # Changelog

### 0.0.25 (2023-11-02)
### 0.0.24 (2023-11-01)

@@ -7,0 +9,0 @@

40

lib/utils.js

@@ -73,6 +73,5 @@ const HEADER_STARTING_NUMBER = 2;

const buildFailureComment = (commentParam, report) => {
const buildFailureComment = (commentParam, failures) => {
let comment = commentParam;
report.items
.filter((item) => item.test_status === 'FAIL')
failures
.forEach((item, index) => {

@@ -90,14 +89,35 @@ if (index === 0) {

const evaluateResult = (result, items) => {
if (isLeafLevel(items)) { // folder with requests
result.requestsFailed.push(...items.filter((request) => request.test_status === 'FAIL'));
result.requestsPassed += items.filter((request) => request.test_status === 'PASS').length; // eslint-disable-line no-param-reassign
result.requestsSkipped += items.filter((request) => request.test_status === 'SKIP').length; // eslint-disable-line no-param-reassign
} else if (isParentLevel(items)) { // folder of folders
items.forEach((folder) => {
evaluateResult(result, folder.subItems);
});
}
return {
...result,
requestsFailed: result.requestsFailed.map((requestFailed) => ({ ...requestFailed })),
};
};
const buildPullRequestComment = (report, options, issueNumber, checkRunId) => {
const { items } = report;
const requestsFailedCount = report.items.filter((item) => item.test_status === 'FAIL').length;
const requestsSkippedCount = report.items.filter((item) => item.test_status === 'SKIP').length;
const initialCount = {
requestsFailed: [],
requestsSkipped: 0,
requestsPassed: 0,
};
const { requestsFailed, requestsSkipped, requestsPassed } = evaluateResult(initialCount, items);
const totalRequests = requestsFailed.length + requestsSkipped + requestsPassed;
const comment = `Please find the complete report [here](${buildCheckPageUrl(options, issueNumber, checkRunId)})
✅ ${items.length - (requestsFailedCount) - requestsSkippedCount} / ${items.length} **Requests Passed**
❌ ${requestsFailedCount} / ${items.length} **Requests Failed**
⏩ ${(requestsSkippedCount)} / ${items.length} **Requests Skipped**`;
✅ ${requestsPassed} / ${totalRequests} **Requests Passed**
❌ ${requestsFailed.length} / ${totalRequests} **Requests Failed**
⏩ ${(requestsSkipped)} / ${totalRequests} **Requests Skipped**`;
return requestsFailedCount > 0
? (`You have some failing tests \n ${buildFailureComment(comment, report)}`)
return requestsFailed.length > 0
? (`You have some failing tests \n ${buildFailureComment(comment, requestsFailed)}`)
: (`Congratulations, All Tests have Passed! \n${comment}`);

@@ -104,0 +124,0 @@ };

{
"name": "@decathlon/newman-reporter-pullrequest-decorator",
"license": "Apache-2.0",
"version": "0.0.24",
"version": "0.0.25",
"description": "Newman reporter allowing to decorate Github's PullRequest with postman collection results",

@@ -6,0 +6,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc