testit-adapter-mocha 5.0.6 → 5.0.7

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
@@ -140,7 +140,8 @@ Methods and properties can be used to specify information about autotest.
140
140
  ### Properties
141
141
 
142
142
  Description of metadata properties:
143
- - `this.workItemsIds` - a method that links autotests with manual tests. Receives the array of manual tests' IDs
143
+ - `this.workItemId` - a method that links an autotest with a manual test. Receives a single globalId
144
+ - `this.workItemsIds` - deprecated, use `this.workItemId` instead
144
145
  - `this.displayName` - internal autotest name (used in Test IT)
145
146
  - `this.externalId` - unique internal autotest ID (used in Test IT)
146
147
  - `this.title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
package/lib/reporter.d.ts CHANGED
@@ -31,6 +31,7 @@ export declare class TmsReporter extends Reporter {
31
31
  addSteps: (title: string, stepConstructor?: (step: ITestStep) => void) => void;
32
32
  private _getNameSpace;
33
33
  private _getClassName;
34
+ private resolveWorkItemIds;
34
35
  private _getOutcome;
35
36
  private _getDuration;
36
37
  }
package/lib/reporter.js CHANGED
@@ -170,6 +170,7 @@ class TmsReporter extends Reporter {
170
170
  ctx.layer = undefined;
171
171
  ctx.tags = [];
172
172
  ctx.classname = undefined;
173
+ ctx.workItemId = undefined;
173
174
  ctx.workItemsIds = [];
174
175
  ctx.parameters = {};
175
176
  ctx.properties = {};
@@ -205,7 +206,7 @@ class TmsReporter extends Reporter {
205
206
  steps: this.currentTest.stepResults,
206
207
  setup,
207
208
  teardown,
208
- workItemIds: test.ctx?.workItemsIds,
209
+ workItemIds: this.resolveWorkItemIds(test.ctx),
209
210
  externalKey: test.title,
210
211
  };
211
212
  const outcome = this._getOutcome(test.state);
@@ -258,6 +259,15 @@ class TmsReporter extends Reporter {
258
259
  _getClassName(path) {
259
260
  return path && testit_js_commons_1.Utils.getFileName(path);
260
261
  }
262
+ resolveWorkItemIds(ctx) {
263
+ if (ctx?.workItemsIds?.length) {
264
+ testit_js_commons_2.logger.warn("workItemsIds is deprecated. Use workItemId with a single globalId instead.");
265
+ }
266
+ if (ctx?.workItemId) {
267
+ return [ctx.workItemId];
268
+ }
269
+ return ctx?.workItemsIds;
270
+ }
261
271
  _getOutcome(state) {
262
272
  switch (state) {
263
273
  case StateConstants.STATE_FAILED:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testit-adapter-mocha",
3
- "version": "5.0.6",
3
+ "version": "5.0.7",
4
4
  "description": "Mocha adapter for Test IT",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/types.d.ts",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "mocha": "^10.2.0",
33
33
  "deasync-promise": "^1.0.1",
34
- "testit-js-commons": "5.0.6"
34
+ "testit-js-commons": "5.0.7"
35
35
  },
36
36
  "files": [
37
37
  "lib"