testit-adapter-mocha 5.0.8-TMS-5.8 → 5.0.8
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 +5 -1
- package/lib/reporter.d.ts +1 -0
- package/lib/reporter.js +13 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -140,12 +140,14 @@ Methods and properties can be used to specify information about autotest.
|
|
|
140
140
|
### Properties
|
|
141
141
|
|
|
142
142
|
Description of metadata properties:
|
|
143
|
-
- `this.
|
|
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
|
|
147
148
|
- `this.description` - autotest description specified in the autotest card
|
|
148
149
|
- `this.labels` - labels listed in the autotest card
|
|
150
|
+
- `this.layer` - test pyramid layer in the autotest card (source **Run**). Use `TestLayers` from `testit-js-commons` for recommended values (`E2E`, `UI`, `API`, `Contract`, `Integration`, `Component`, `Unit`), or any custom string
|
|
149
151
|
- `this.tags` - tags listed in the autotest card
|
|
150
152
|
- `this.links` - links listed in the autotest card
|
|
151
153
|
- `this.nameSpace` - directory in the TMS system (default - directory's name of test)
|
|
@@ -168,6 +170,7 @@ Description of methods:
|
|
|
168
170
|
|
|
169
171
|
import assert from "assert";
|
|
170
172
|
import {Context, Link} from "testit-adapter-mocha";
|
|
173
|
+
import { TestLayers } from "testit-js-commons";
|
|
171
174
|
|
|
172
175
|
const links: Link[] = [
|
|
173
176
|
{ url: "https://test01.example", title: "Example01", description: "Example01 description", type: "Issue" },
|
|
@@ -188,6 +191,7 @@ it('All annotations and methods', function (this: Context) {
|
|
|
188
191
|
this.title = 'title';
|
|
189
192
|
this.description = 'description';
|
|
190
193
|
this.labels = ['label1', 'label2'];
|
|
194
|
+
this.layer = TestLayers.API;
|
|
191
195
|
this.links = links;
|
|
192
196
|
|
|
193
197
|
this.addMessage('This is a message');
|
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
|
@@ -167,8 +167,10 @@ class TmsReporter extends Reporter {
|
|
|
167
167
|
ctx.description = undefined;
|
|
168
168
|
ctx.links = [];
|
|
169
169
|
ctx.labels = [];
|
|
170
|
+
ctx.layer = undefined;
|
|
170
171
|
ctx.tags = [];
|
|
171
172
|
ctx.classname = undefined;
|
|
173
|
+
ctx.workItemId = undefined;
|
|
172
174
|
ctx.workItemsIds = [];
|
|
173
175
|
ctx.parameters = {};
|
|
174
176
|
ctx.properties = {};
|
|
@@ -197,13 +199,14 @@ class TmsReporter extends Reporter {
|
|
|
197
199
|
title: test.ctx?.title,
|
|
198
200
|
links: test.ctx?.links,
|
|
199
201
|
labels: test.ctx?.labels?.map((label) => ({ name: label })),
|
|
202
|
+
layer: test.ctx?.layer,
|
|
200
203
|
tags: test.ctx?.tags,
|
|
201
204
|
namespace: test.ctx?.namespace ?? this._getNameSpace(test.file),
|
|
202
205
|
classname: test.ctx?.classname ?? this._getClassName(test.file),
|
|
203
206
|
steps: this.currentTest.stepResults,
|
|
204
207
|
setup,
|
|
205
208
|
teardown,
|
|
206
|
-
workItemIds: test.ctx
|
|
209
|
+
workItemIds: this.resolveWorkItemIds(test.ctx),
|
|
207
210
|
externalKey: test.title,
|
|
208
211
|
};
|
|
209
212
|
const outcome = this._getOutcome(test.state);
|
|
@@ -256,6 +259,15 @@ class TmsReporter extends Reporter {
|
|
|
256
259
|
_getClassName(path) {
|
|
257
260
|
return path && testit_js_commons_1.Utils.getFileName(path);
|
|
258
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
|
+
}
|
|
259
271
|
_getOutcome(state) {
|
|
260
272
|
switch (state) {
|
|
261
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.8
|
|
3
|
+
"version": "5.0.8",
|
|
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.8
|
|
34
|
+
"testit-js-commons": "5.0.8"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"lib"
|