testit-adapter-jest 5.0.6 → 5.0.8-TMS-5.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 +0 -4
- package/dist/testitEnvironment.d.ts +0 -2
- package/dist/testitEnvironment.js +27 -25
- package/package.json +2 -2
- package/types.d.ts +0 -2
package/README.md
CHANGED
|
@@ -129,7 +129,6 @@ Description of metadata methods:
|
|
|
129
129
|
- `testit.title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
|
|
130
130
|
- `testit.description` - autotest description specified in the autotest card
|
|
131
131
|
- `testit.labels` - labels listed in the autotest card
|
|
132
|
-
- `testit.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
|
|
133
132
|
- `testit.tags` - tags listed in the autotest card
|
|
134
133
|
- `testit.link` - links listed in the autotest card
|
|
135
134
|
- `testit.namespace` - directory in the TMS system (default - directory's name of test)
|
|
@@ -145,15 +144,12 @@ Description of methods:
|
|
|
145
144
|
|
|
146
145
|
#### Simple test
|
|
147
146
|
```js
|
|
148
|
-
import { TestLayers } from 'testit-js-commons';
|
|
149
|
-
|
|
150
147
|
test('All annotations', () => {
|
|
151
148
|
testit.externalId('all_annotations');
|
|
152
149
|
testit.displayName('All annotations');
|
|
153
150
|
testit.title('All annotations title');
|
|
154
151
|
testit.description('Test with all annotations');
|
|
155
152
|
testit.labels(['label1', 'label2']);
|
|
156
|
-
testit.layer(TestLayers.API);
|
|
157
153
|
|
|
158
154
|
testit.addMessage('This is a message');
|
|
159
155
|
testit.addLinks([
|
|
@@ -47,7 +47,6 @@ export default class TestItEnvironment extends NodeEnvironment {
|
|
|
47
47
|
private snapshotAutotestData;
|
|
48
48
|
private buildSetupSteps;
|
|
49
49
|
private buildTeardownSteps;
|
|
50
|
-
private buildAutotestPost;
|
|
51
50
|
private sendRealtimePayload;
|
|
52
51
|
/** afterAll hooks run after all tests; patch teardown when importRealtime is enabled. */
|
|
53
52
|
private flushRealtimeTeardown;
|
|
@@ -62,7 +61,6 @@ export default class TestItEnvironment extends NodeEnvironment {
|
|
|
62
61
|
addAttachments(attachments: string[]): void;
|
|
63
62
|
setLinks(links: Link[]): void;
|
|
64
63
|
setLabels(labels: string[]): void;
|
|
65
|
-
setLayer(layer: string): void;
|
|
66
64
|
setTags(tags: string[]): void;
|
|
67
65
|
setWorkItems(workItems: string[]): void;
|
|
68
66
|
setParams(params: any): void;
|
|
@@ -94,7 +94,6 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
94
94
|
displayName: this.setDisplayName.bind(this),
|
|
95
95
|
links: this.setLinks.bind(this),
|
|
96
96
|
labels: this.setLabels.bind(this),
|
|
97
|
-
layer: this.setLayer.bind(this),
|
|
98
97
|
tags: this.setTags.bind(this),
|
|
99
98
|
workItemIds: this.setWorkItems.bind(this),
|
|
100
99
|
params: this.setParams.bind(this),
|
|
@@ -287,15 +286,24 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
287
286
|
const afterEach = autotest.afterEach;
|
|
288
287
|
return includeAfterAll ? afterEach.concat(this.afterAllSteps) : afterEach;
|
|
289
288
|
}
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
async sendRealtimePayload(autotest, result, includeAfterAll) {
|
|
290
|
+
const setupSteps = this.buildSetupSteps(autotest);
|
|
291
|
+
const teardownSteps = this.buildTeardownSteps(autotest, includeAfterAll);
|
|
292
|
+
testit_js_commons_2.logger.debug("[jest-env] sendRealtimePayload", {
|
|
293
|
+
externalId: autotest.externalId,
|
|
294
|
+
outcome: result.outcome,
|
|
295
|
+
includeAfterAll,
|
|
296
|
+
setupSteps: setupSteps.length,
|
|
297
|
+
teardownSteps: teardownSteps.length,
|
|
298
|
+
testSteps: autotest.testSteps.length,
|
|
299
|
+
});
|
|
300
|
+
const autotestPost = {
|
|
292
301
|
externalId: autotest.externalId,
|
|
293
302
|
title: autotest.title,
|
|
294
303
|
name: autotest.name,
|
|
295
304
|
description: autotest.description,
|
|
296
305
|
links: autotest.links,
|
|
297
306
|
labels: autotest.labels,
|
|
298
|
-
layer: autotest.layer,
|
|
299
307
|
tags: autotest.tags,
|
|
300
308
|
namespace: autotest.namespace ?? testit_js_commons_1.Utils.getDir(this.testPath),
|
|
301
309
|
classname: autotest.classname ?? testit_js_commons_1.Utils.getFileName(this.testPath),
|
|
@@ -303,21 +311,7 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
303
311
|
steps: autotest.testSteps,
|
|
304
312
|
teardown: teardownSteps,
|
|
305
313
|
externalKey: autotest.externalKey,
|
|
306
|
-
workItemIds: autotest.workItemIds,
|
|
307
314
|
};
|
|
308
|
-
}
|
|
309
|
-
async sendRealtimePayload(autotest, result, includeAfterAll) {
|
|
310
|
-
const setupSteps = this.buildSetupSteps(autotest);
|
|
311
|
-
const teardownSteps = this.buildTeardownSteps(autotest, includeAfterAll);
|
|
312
|
-
testit_js_commons_2.logger.debug("[jest-env] sendRealtimePayload", {
|
|
313
|
-
externalId: autotest.externalId,
|
|
314
|
-
outcome: result.outcome,
|
|
315
|
-
includeAfterAll,
|
|
316
|
-
setupSteps: setupSteps.length,
|
|
317
|
-
teardownSteps: teardownSteps.length,
|
|
318
|
-
testSteps: autotest.testSteps.length,
|
|
319
|
-
});
|
|
320
|
-
const autotestPost = this.buildAutotestPost(autotest, setupSteps, teardownSteps);
|
|
321
315
|
await this.strategy.loadAutotest(autotestPost, result.outcome);
|
|
322
316
|
await this.strategy.loadTestRun([
|
|
323
317
|
{
|
|
@@ -357,8 +351,6 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
357
351
|
if (setupSteps.length === 0 && teardownSteps.length === 0) {
|
|
358
352
|
continue;
|
|
359
353
|
}
|
|
360
|
-
const autotestPost = this.buildAutotestPost(autotest, setupSteps, teardownSteps);
|
|
361
|
-
await this.strategy.loadAutotest(autotestPost, result.outcome);
|
|
362
354
|
await this.strategy.updateSetupTeardown([
|
|
363
355
|
{
|
|
364
356
|
autoTestExternalId: autotest.externalId,
|
|
@@ -388,7 +380,21 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
388
380
|
log("Mapping autotest %s", autotest.name);
|
|
389
381
|
const setupSteps = this.beforeAllSteps.concat(autotest.beforeEach);
|
|
390
382
|
const teardownSteps = autotest.afterEach.concat(this.afterAllSteps);
|
|
391
|
-
const autotestPost =
|
|
383
|
+
const autotestPost = {
|
|
384
|
+
externalId: autotest.externalId,
|
|
385
|
+
title: autotest.title,
|
|
386
|
+
name: autotest.name,
|
|
387
|
+
description: autotest.description,
|
|
388
|
+
links: autotest.links,
|
|
389
|
+
labels: autotest.labels,
|
|
390
|
+
tags: autotest.tags,
|
|
391
|
+
namespace: autotest.namespace ?? testit_js_commons_1.Utils.getDir(this.testPath),
|
|
392
|
+
classname: autotest.classname ?? testit_js_commons_1.Utils.getFileName(this.testPath),
|
|
393
|
+
setup: setupSteps,
|
|
394
|
+
steps: autotest.testSteps,
|
|
395
|
+
teardown: teardownSteps,
|
|
396
|
+
externalKey: autotest.externalKey,
|
|
397
|
+
};
|
|
392
398
|
try {
|
|
393
399
|
await this.strategy.loadAutotest(autotestPost, result.outcome);
|
|
394
400
|
}
|
|
@@ -480,10 +486,6 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
480
486
|
log("Setting labels to %s", this.autotestData.name);
|
|
481
487
|
this.autotestData.labels = labels.map((label) => ({ name: label }));
|
|
482
488
|
}
|
|
483
|
-
setLayer(layer) {
|
|
484
|
-
log("Setting layer to %s for %s", layer, this.autotestData.name);
|
|
485
|
-
this.autotestData.layer = layer;
|
|
486
|
-
}
|
|
487
489
|
setTags(tags) {
|
|
488
490
|
log("Setting tags to %s", this.autotestData.name);
|
|
489
491
|
this.autotestData.tags = tags;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testit-adapter-jest",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.8-TMS-5.8",
|
|
4
4
|
"description": "Jest adapter for Test IT",
|
|
5
5
|
"main": "dist/testitEnvironment.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"debug": "^4.3.4",
|
|
19
|
-
"testit-js-commons": "5.0.
|
|
19
|
+
"testit-js-commons": "5.0.8-TMS-5.8"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/debug": "^4.1.7",
|
package/types.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ declare global {
|
|
|
6
6
|
displayName(name: string): void;
|
|
7
7
|
links(links: Link[]): void;
|
|
8
8
|
labels(labels: string[]): void;
|
|
9
|
-
layer(layer: string): void;
|
|
10
|
-
tags(tags: string[]): void;
|
|
11
9
|
workItemIds(workItemsIds: string[]): void;
|
|
12
10
|
params(params: any): void;
|
|
13
11
|
step(name: string, description?: string): void;
|