newman-reporter-qase 2.1.2 → 2.1.4

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/changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ # qase-newman@2.1.4
2
+
3
+ ## What's new
4
+
5
+ Fixed an issue where the start and end times were not properly set in the test results. Now results correctly display the
6
+ start and end times.
7
+
1
8
  # qase-newman@2.1.1
2
9
 
3
10
  ## What's new
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
3
  import { NewmanRunOptions } from 'newman';
4
+ import { EventList, Item, PropertyBase, PropertyBaseDefinition } from 'postman-collection';
4
5
  import { ConfigType, ConfigLoader } from 'qase-javascript-commons';
5
6
  export type NewmanQaseOptionsType = ConfigType;
6
7
  /**
@@ -18,21 +19,18 @@ export declare class NewmanQaseReporter {
18
19
  /**
19
20
  * @param {EventList} eventList
20
21
  * @returns {number[]}
21
- * @private
22
22
  */
23
- private static getCaseIds;
23
+ static getCaseIds(eventList: EventList): number[];
24
24
  /**
25
25
  * @param {Item} item
26
26
  * @returns {string[]}
27
- * @private
28
27
  */
29
- private static getParameters;
28
+ static getParameters(item: Item): string[];
30
29
  /**
31
30
  * @param {PropertyBase<PropertyBaseDefinition>} item
32
31
  * @returns {string[]}
33
- * @private
34
32
  */
35
- private static getParentTitles;
33
+ static getParentTitles(item: PropertyBase<PropertyBaseDefinition>): string[];
36
34
  /**
37
35
  * @type {ReporterInterface}
38
36
  * @private
package/dist/reporter.js CHANGED
@@ -22,7 +22,6 @@ class NewmanQaseReporter {
22
22
  /**
23
23
  * @param {EventList} eventList
24
24
  * @returns {number[]}
25
- * @private
26
25
  */
27
26
  static getCaseIds(eventList) {
28
27
  const ids = [];
@@ -41,7 +40,6 @@ class NewmanQaseReporter {
41
40
  /**
42
41
  * @param {Item} item
43
42
  * @returns {string[]}
44
- * @private
45
43
  */
46
44
  static getParameters(item) {
47
45
  const params = [];
@@ -65,7 +63,6 @@ class NewmanQaseReporter {
65
63
  /**
66
64
  * @param {PropertyBase<PropertyBaseDefinition>} item
67
65
  * @returns {string[]}
68
- * @private
69
66
  */
70
67
  static getParentTitles(item) {
71
68
  let titles = [];
@@ -190,12 +187,25 @@ class NewmanQaseReporter {
190
187
  const timer = this.timerMap.get(item.id);
191
188
  if (timer) {
192
189
  const now = Date.now();
193
- pendingResult.execution.duration = now - timer;
194
- pendingResult.execution.start_time = timer / 1000;
195
- pendingResult.execution.end_time = now / 1000;
190
+ const durationMs = now - timer;
191
+ // Ensure duration is not negative and times are valid
192
+ if (durationMs >= 0) {
193
+ pendingResult.execution.duration = Math.round(durationMs);
194
+ pendingResult.execution.start_time = timer / 1000;
195
+ pendingResult.execution.end_time = now / 1000;
196
+ }
197
+ else {
198
+ // Fallback for edge cases where timer might be incorrect
199
+ pendingResult.execution.duration = 0;
200
+ pendingResult.execution.start_time = now / 1000;
201
+ pendingResult.execution.end_time = now / 1000;
202
+ }
196
203
  }
197
204
  pendingResult.params = this.prepareParameters(item, exec.cursor.iteration);
198
205
  void this.reporter.addTestResult(pendingResult);
206
+ // Clean up timer and pending result after processing
207
+ this.timerMap.delete(item.id);
208
+ this.pendingResultMap.delete(item.id);
199
209
  }
200
210
  });
201
211
  runner.on('beforeDone', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newman-reporter-qase",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Qase TMS Newman Reporter",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "author": "Qase Team <support@qase.io>",
40
40
  "license": "Apache-2.0",
41
41
  "dependencies": {
42
- "qase-javascript-commons": "~2.3.3",
42
+ "qase-javascript-commons": "~2.4.1",
43
43
  "semver": "^7.5.1"
44
44
  },
45
45
  "devDependencies": {