testit-adapter-codecept 5.0.9-TMS-5.8 → 5.1.0-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/build/bootstrap.js
CHANGED
|
@@ -3,13 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const codeceptjs_1 = require("codeceptjs");
|
|
4
4
|
const testit_js_commons_1 = require("testit-js-commons");
|
|
5
5
|
const builders_1 = require("./builders");
|
|
6
|
-
module.exports = async function (
|
|
6
|
+
module.exports = async function () {
|
|
7
7
|
const config = new testit_js_commons_1.ConfigComposer().compose();
|
|
8
8
|
const strategy = testit_js_commons_1.StrategyFactory.create(config);
|
|
9
9
|
const helper = codeceptjs_1.container.helpers("TestITHelper");
|
|
10
10
|
await strategy.setup();
|
|
11
|
+
let finalized = false;
|
|
12
|
+
const finalize = async () => {
|
|
13
|
+
if (finalized) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
finalized = true;
|
|
17
|
+
await strategy.teardown();
|
|
18
|
+
};
|
|
11
19
|
codeceptjs_1.event.dispatcher.on(codeceptjs_1.event.test.finished, (test) => {
|
|
12
20
|
codeceptjs_1.recorder.add("transferTestAndRuns", async () => {
|
|
21
|
+
// Keep sync-storage LastStatus fresh; otherwise Force Work X fires after ~60s of in_progress.
|
|
22
|
+
await strategy.touchWorker();
|
|
13
23
|
const autotest = builders_1.TestsBuilder.build(test);
|
|
14
24
|
await strategy.loadAutotest(autotest, test.state);
|
|
15
25
|
const result = await new builders_1.ResultBuilder(config).build(test, helper.metadata);
|
|
@@ -17,7 +27,20 @@ module.exports = async function (options) {
|
|
|
17
27
|
helper.metadata = {};
|
|
18
28
|
});
|
|
19
29
|
});
|
|
30
|
+
// Single-process `codeceptjs run` — workers.after never fires.
|
|
31
|
+
codeceptjs_1.event.dispatcher.on(codeceptjs_1.event.all.result, () => {
|
|
32
|
+
if (process.env.RUNS_WITH_WORKERS) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
codeceptjs_1.recorder.add("testitTeardown", async () => {
|
|
36
|
+
await finalize();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
// Parallel `codeceptjs run-workers`.
|
|
40
|
+
codeceptjs_1.event.dispatcher.on(codeceptjs_1.event.workers.result, async () => {
|
|
41
|
+
await finalize();
|
|
42
|
+
});
|
|
20
43
|
codeceptjs_1.event.dispatcher.on(codeceptjs_1.event.workers.after, async () => {
|
|
21
|
-
await
|
|
44
|
+
await finalize();
|
|
22
45
|
});
|
|
23
46
|
};
|
|
@@ -10,7 +10,7 @@ class ResultBuilder {
|
|
|
10
10
|
this.additions = new testit_js_commons_1.Additions(config);
|
|
11
11
|
}
|
|
12
12
|
async build(test, metadata) {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
const { _beforeEach, _afterEach, _afterAll, _beforeAll } = test.parent;
|
|
@@ -24,7 +24,7 @@ class ResultBuilder {
|
|
|
24
24
|
...this.reduceAfterOrBeforeSuites(_beforeAll),
|
|
25
25
|
];
|
|
26
26
|
let traces = typeof ((_e = test === null || test === void 0 ? void 0 : test.err) === null || _e === void 0 ? void 0 : _e.cliMessage) === "function" ? test.err.cliMessage() : (_f = test === null || test === void 0 ? void 0 : test.err) === null || _f === void 0 ? void 0 : _f.stack;
|
|
27
|
-
let message =
|
|
27
|
+
let message = metadata === null || metadata === void 0 ? void 0 : metadata.message;
|
|
28
28
|
// If TMS_IS_CI env is true, trim traces and message to 20 chars and log this
|
|
29
29
|
if (process.env.TMS_IS_CI === "true") {
|
|
30
30
|
if (typeof traces === "string" && traces.length > 20) {
|
|
@@ -37,17 +37,17 @@ class ResultBuilder {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
|
-
autoTestExternalId: (
|
|
40
|
+
autoTestExternalId: (_g = (0, utils_1.useDefaultHash)(test)) !== null && _g !== void 0 ? _g : (0, utils_1.useCompositeHash)(test),
|
|
41
41
|
links: metadata === null || metadata === void 0 ? void 0 : metadata.links,
|
|
42
42
|
startedOn: new Date(test.startedAt),
|
|
43
43
|
duration: test.duration,
|
|
44
44
|
attachments: await this.loadAttachments(test, metadata),
|
|
45
|
-
parameters,
|
|
45
|
+
parameters: Object.keys(parameters).length > 0 ? parameters : undefined,
|
|
46
46
|
traces: traces,
|
|
47
47
|
teardownResults,
|
|
48
48
|
setupResults,
|
|
49
49
|
completedOn: test.duration ? new Date(test.startedAt + test.duration) : undefined,
|
|
50
|
-
message
|
|
50
|
+
message,
|
|
51
51
|
outcome: test.state === "passed" ? "Passed" : "Failed",
|
|
52
52
|
stepResults: this.buildManySteps(test.steps),
|
|
53
53
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testit-adapter-codecept",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0-TMS-5.8",
|
|
4
4
|
"description": "Codecept adapter for Test IT",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"watch": "tsc -p tsconfig.json -w"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"testit-js-commons": "5.0
|
|
18
|
+
"testit-js-commons": "5.1.0-TMS-5.8"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@codeceptjs/configure": "^0.10.0",
|