newman-reporter-qase 2.0.0-beta.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- > # Qase TMS Newman reporter
2
- >
3
- > Publish results simple and easy.
1
+ # Qase TMS Newman reporter
4
2
 
5
- ## How to integrate
3
+ Publish results simple and easy.
4
+
5
+ To install the latest version, run:
6
6
 
7
7
  ```bash
8
8
  npm install newman-reporter-qase
package/changelog.md ADDED
@@ -0,0 +1,23 @@
1
+ # qase-newman@2.0.0
2
+
3
+ ## What's new
4
+
5
+ This is the first release in the 2.x series of the Newman reporter.
6
+ It brings new and more flexible configs, uploading results in parallel with running tests,
7
+ and other powerful features.
8
+
9
+ This changelog entry will be updated soon.
10
+ For more information about the new features and a guide for migration from v1, refer to the
11
+ [reporter documentation](https://github.com/qase-tms/qase-javascript/tree/main/qase-newman#readme)
12
+
13
+ # qase-newman@2.0.0-beta.2
14
+
15
+ ## What's new
16
+
17
+ Add support for suites in test results.
18
+
19
+ # qase-newman@2.0.0-beta.1
20
+
21
+ ## What's new
22
+
23
+ First major beta release for the version 2 series of the Qase Newman reporter.
package/dist/reporter.js CHANGED
@@ -35,14 +35,15 @@ class NewmanQaseReporter {
35
35
  * @returns {string[]}
36
36
  * @private
37
37
  */
38
- static getParentTitles(item, titles = []) {
39
- const parent = item.parent();
40
- if (parent) {
41
- NewmanQaseReporter.getParentTitles(parent, titles);
42
- }
38
+ static getParentTitles(item) {
39
+ const titles = [];
43
40
  if ('name' in item) {
44
41
  titles.push(String(item.name));
45
42
  }
43
+ const parent = item.parent();
44
+ if (parent) {
45
+ titles.concat(NewmanQaseReporter.getParentTitles(parent));
46
+ }
46
47
  return titles;
47
48
  }
48
49
  /**
@@ -63,7 +64,7 @@ class NewmanQaseReporter {
63
64
  */
64
65
  this.timerMap = new Map();
65
66
  const config = configLoader.load();
66
- this.reporter = new qase_javascript_commons_1.QaseReporter({
67
+ this.reporter = qase_javascript_commons_1.QaseReporter.getInstance({
67
68
  ...(0, qase_javascript_commons_1.composeOptions)(options, config),
68
69
  frameworkPackage: 'newman',
69
70
  frameworkName: 'newman',
@@ -76,16 +77,50 @@ class NewmanQaseReporter {
76
77
  * @private
77
78
  */
78
79
  addRunnerListeners(runner) {
80
+ runner.on('start', () => {
81
+ this.reporter.startTestRun();
82
+ });
79
83
  runner.on('beforeItem', (_err, exec) => {
80
84
  const { item } = exec;
81
85
  const parent = item.parent();
86
+ const suites = parent ? NewmanQaseReporter.getParentTitles(parent) : [];
87
+ let relation = null;
88
+ if (suites.length > 0) {
89
+ const data = suites.map(title => {
90
+ return {
91
+ title: title,
92
+ public_id: null,
93
+ };
94
+ });
95
+ relation = {
96
+ suite: {
97
+ data: data,
98
+ },
99
+ };
100
+ }
101
+ const ids = NewmanQaseReporter.getCaseIds(item.events);
82
102
  this.pendingResultMap.set(item.id, {
103
+ attachments: [],
104
+ author: null,
105
+ execution: {
106
+ status: qase_javascript_commons_1.TestStatusEnum.passed,
107
+ start_time: 0,
108
+ end_time: 0,
109
+ duration: 0,
110
+ stacktrace: null,
111
+ thread: null,
112
+ },
113
+ fields: {},
114
+ message: null,
115
+ muted: false,
116
+ params: {},
117
+ relations: relation,
118
+ run_id: null,
119
+ signature: '',
120
+ steps: [],
121
+ testops_id: ids.length > 0 ? ids : null,
83
122
  id: item.id,
84
- testOpsId: NewmanQaseReporter.getCaseIds(item.events),
85
123
  title: item.name,
86
- suiteTitle: parent ? NewmanQaseReporter.getParentTitles(parent) : [],
87
- status: qase_javascript_commons_1.TestStatusEnum.passed,
88
- duration: 0,
89
124
  });
90
125
  this.timerMap.set(item.id, Date.now());
91
126
  });
@@ -93,8 +128,9 @@ class NewmanQaseReporter {
93
128
  const { item } = exec;
94
129
  const pendingResult = this.pendingResultMap.get(item.id);
95
130
  if (pendingResult && err) {
96
- pendingResult.status = qase_javascript_commons_1.TestStatusEnum.failed;
97
- pendingResult.error = err;
131
+ pendingResult.execution.status = qase_javascript_commons_1.TestStatusEnum.failed;
132
+ pendingResult.execution.stacktrace = err.stack ?? null;
133
+ pendingResult.message = err.message;
98
134
  }
99
135
  });
100
136
  runner.on('item', (_err, exec) => {
@@ -104,11 +140,9 @@ class NewmanQaseReporter {
104
140
  const timer = this.timerMap.get(item.id);
105
141
  if (timer) {
106
142
  const now = Date.now();
107
- pendingResult.startTime = timer;
108
- pendingResult.duration = now - timer;
109
- pendingResult.endTime = now;
143
+ pendingResult.execution.duration = now - timer;
110
144
  }
111
- this.reporter.addTestResult(pendingResult);
145
+ void this.reporter.addTestResult(pendingResult);
112
146
  }
113
147
  });
114
148
  runner.on('beforeDone', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newman-reporter-qase",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0",
4
4
  "description": "Qase TMS Newman Reporter",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -36,10 +36,10 @@
36
36
  "test": "jest --passWithNoTests",
37
37
  "clean": "rm -rf dist"
38
38
  },
39
- "author": "Parviz Khavari <havaripa@gmail.com>",
39
+ "author": "Qase Team <support@qase.io>",
40
40
  "license": "Apache-2.0",
41
41
  "dependencies": {
42
- "qase-javascript-commons": "^2.0.0-beta.1",
42
+ "qase-javascript-commons": "^2.0.9",
43
43
  "semver": "^7.5.1"
44
44
  },
45
45
  "devDependencies": {