New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

newman-reporter-qase

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

newman-reporter-qase - npm Package Compare versions

Comparing version

to
2.0.0-beta.2

@@ -38,10 +38,11 @@ "use strict";

*/
static getParentTitles(item, titles = []) {
static getParentTitles(item) {
const titles = [];
if ('name' in item) {
titles.push(String(item.name));
}
const parent = item.parent();
if (parent) {
NewmanQaseReporter.getParentTitles(parent, titles);
titles.concat(NewmanQaseReporter.getParentTitles(parent));
}
if ('name' in item) {
titles.push(String(item.name));
}
return titles;

@@ -67,3 +68,3 @@ }

const config = configLoader.load();
this.reporter = new qase_javascript_commons_1.QaseReporter({
this.reporter = qase_javascript_commons_1.QaseReporter.getInstance({
...(0, qase_javascript_commons_1.composeOptions)(options, config),

@@ -81,12 +82,46 @@ frameworkPackage: 'newman',

addRunnerListeners(runner) {
runner.on('start', () => {
this.reporter.startTestRun();
});
runner.on('beforeItem', (_err, exec) => {
const { item } = exec;
const parent = item.parent();
const suites = parent ? NewmanQaseReporter.getParentTitles(parent) : [];
let relation = null;
if (suites.length > 0) {
const data = suites.map(title => {
return {
title: title,
public_id: null,
};
});
relation = {
suite: {
data: data,
},
};
}
const ids = NewmanQaseReporter.getCaseIds(item.events);
this.pendingResultMap.set(item.id, {
attachments: [],
author: null,
execution: {
status: qase_javascript_commons_1.TestStatusEnum.passed,
start_time: 0,
end_time: 0,
duration: 0,
stacktrace: null,
thread: null,
},
fields: {},
message: null,
muted: false,
params: {},
relations: relation,
run_id: null,
signature: '',
steps: [],
testops_id: ids.length > 0 ? ids : null,
id: item.id,
testOpsId: NewmanQaseReporter.getCaseIds(item.events),
title: item.name,
suiteTitle: parent ? NewmanQaseReporter.getParentTitles(parent) : [],
status: qase_javascript_commons_1.TestStatusEnum.passed,
duration: 0,
});

@@ -99,4 +134,5 @@ this.timerMap.set(item.id, Date.now());

if (pendingResult && err) {
pendingResult.status = qase_javascript_commons_1.TestStatusEnum.failed;
pendingResult.error = err;
pendingResult.execution.status = qase_javascript_commons_1.TestStatusEnum.failed;
pendingResult.execution.stacktrace = err.stack ?? null;
pendingResult.message = err.message;
}

@@ -111,7 +147,5 @@ });

const now = Date.now();
pendingResult.startTime = timer;
pendingResult.duration = now - timer;
pendingResult.endTime = now;
pendingResult.execution.duration = now - timer;
}
this.reporter.addTestResult(pendingResult);
void this.reporter.addTestResult(pendingResult);
}

@@ -118,0 +152,0 @@ });

{
"name": "newman-reporter-qase",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"description": "Qase TMS Newman Reporter",

@@ -42,3 +42,3 @@ "main": "./dist/index.js",

"dependencies": {
"qase-javascript-commons": "^2.0.0-beta.1",
"qase-javascript-commons": "^2.0.8",
"semver": "^7.5.1"

@@ -45,0 +45,0 @@ },

@@ -1,9 +0,10 @@

> # Qase TMS Newman reporter
>
> Publish results simple and easy.
# Qase TMS Newman reporter
## How to integrate
Publish results simple and easy.
The Newman reporter is currently in the closed beta stage.
To install the latest beta version, run:
```bash
npm install newman-reporter-qase
npm install newman-reporter-qase@beta
```

@@ -10,0 +11,0 @@