testit-adapter-codecept 3.2.8 → 3.2.9-TMS-5.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.
@@ -3,7 +3,6 @@ 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
- const utils_1 = require("./common/utils");
7
6
  module.exports = async function (options) {
8
7
  const config = new testit_js_commons_1.ConfigComposer().compose();
9
8
  const strategy = testit_js_commons_1.StrategyFactory.create(config);
@@ -12,7 +11,7 @@ module.exports = async function (options) {
12
11
  codeceptjs_1.event.dispatcher.on(codeceptjs_1.event.test.finished, (test) => {
13
12
  codeceptjs_1.recorder.add("transferTestAndRuns", async () => {
14
13
  const autotest = builders_1.TestsBuilder.build(test);
15
- await strategy.loadAutotest(autotest, (0, utils_1.isPassed)(test));
14
+ await strategy.loadAutotest(autotest, test.state);
16
15
  const result = await new builders_1.ResultBuilder(config).build(test, helper.metadata);
17
16
  await strategy.loadTestRun([result]);
18
17
  helper.metadata = {};
@@ -22,18 +22,31 @@ class ResultBuilder {
22
22
  ...this.reduceAfterOrBeforeSuites(_beforeEach),
23
23
  ...this.reduceAfterOrBeforeSuites(_beforeAll),
24
24
  ];
25
+ 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;
26
+ let message = (_g = metadata === null || metadata === void 0 ? void 0 : metadata.message) !== null && _g !== void 0 ? _g : null;
27
+ // If TMS_IS_CI env is true, trim traces and message to 20 chars and log this
28
+ if (process.env.TMS_IS_CI === "true") {
29
+ if (typeof traces === "string" && traces.length > 20) {
30
+ console.log("TMS_IS_CI is true: trimming traces to 20 chars");
31
+ traces = traces.slice(0, 20);
32
+ }
33
+ if (typeof message === "string" && message.length > 20) {
34
+ console.log("TMS_IS_CI is true: trimming message to 20 chars");
35
+ message = message.slice(0, 20);
36
+ }
37
+ }
25
38
  return {
26
- autoTestExternalId: (_e = (0, utils_1.useDefaultHash)(test)) !== null && _e !== void 0 ? _e : (0, utils_1.useCompositeHash)(test),
39
+ autoTestExternalId: (_h = (0, utils_1.useDefaultHash)(test)) !== null && _h !== void 0 ? _h : (0, utils_1.useCompositeHash)(test),
27
40
  links: metadata === null || metadata === void 0 ? void 0 : metadata.links,
28
41
  startedOn: new Date(test.startedAt),
29
42
  duration: test.duration,
30
43
  attachments: await this.loadAttachments(test, metadata),
31
44
  parameters,
32
- traces: typeof ((_f = test === null || test === void 0 ? void 0 : test.err) === null || _f === void 0 ? void 0 : _f.cliMessage) === "function" ? test.err.cliMessage() : (_g = test === null || test === void 0 ? void 0 : test.err) === null || _g === void 0 ? void 0 : _g.stack,
45
+ traces: traces,
33
46
  teardownResults,
34
47
  setupResults,
35
48
  completedOn: test.duration ? new Date(test.startedAt + test.duration) : undefined,
36
- message: (_h = metadata === null || metadata === void 0 ? void 0 : metadata.message) !== null && _h !== void 0 ? _h : null,
49
+ message: message,
37
50
  outcome: test.state === "passed" ? "Passed" : "Failed",
38
51
  stepResults: this.buildManySteps(test.steps),
39
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testit-adapter-codecept",
3
- "version": "3.2.8",
3
+ "version": "3.2.9-TMS-5.4",
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": "3.2.8"
18
+ "testit-js-commons": "3.2.9-TMS-5.4"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@codeceptjs/configure": "^0.10.0",