@tiden/reporter-commons 0.1.0

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.
Files changed (174) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +201 -0
  3. package/README.md +34 -0
  4. package/dist/client/interface.d.ts +8 -0
  5. package/dist/client/interface.js +2 -0
  6. package/dist/client/reporter-api-models.d.ts +96 -0
  7. package/dist/client/reporter-api-models.js +2 -0
  8. package/dist/client/reporter-api.d.ts +14 -0
  9. package/dist/client/reporter-api.js +25 -0
  10. package/dist/client/services/api-error-handler.d.ts +10 -0
  11. package/dist/client/services/api-error-handler.js +44 -0
  12. package/dist/client/services/attachment-service.d.ts +29 -0
  13. package/dist/client/services/attachment-service.js +268 -0
  14. package/dist/client/services/result-transformer.d.ts +21 -0
  15. package/dist/client/services/result-transformer.js +180 -0
  16. package/dist/client/services/run-service.d.ts +20 -0
  17. package/dist/client/services/run-service.js +68 -0
  18. package/dist/client/tiden-client.d.ts +34 -0
  19. package/dist/client/tiden-client.js +99 -0
  20. package/dist/client/tiden-http.d.ts +11 -0
  21. package/dist/client/tiden-http.js +23 -0
  22. package/dist/config/config-loader-interface.d.ts +4 -0
  23. package/dist/config/config-loader-interface.js +2 -0
  24. package/dist/config/config-loader.d.ts +10 -0
  25. package/dist/config/config-loader.js +60 -0
  26. package/dist/config/config-type.d.ts +2 -0
  27. package/dist/config/config-type.js +2 -0
  28. package/dist/config/config-validation-schema.d.ts +212 -0
  29. package/dist/config/config-validation-schema.js +213 -0
  30. package/dist/config/index.d.ts +4 -0
  31. package/dist/config/index.js +7 -0
  32. package/dist/core/options-resolver.d.ts +19 -0
  33. package/dist/core/options-resolver.js +47 -0
  34. package/dist/core/reporter-factory.d.ts +18 -0
  35. package/dist/core/reporter-factory.js +63 -0
  36. package/dist/core/status-processor.d.ts +17 -0
  37. package/dist/core/status-processor.js +48 -0
  38. package/dist/env/env-enum.d.ts +64 -0
  39. package/dist/env/env-enum.js +75 -0
  40. package/dist/env/env-to-config.d.ts +7 -0
  41. package/dist/env/env-to-config.js +60 -0
  42. package/dist/env/env-type.d.ts +29 -0
  43. package/dist/env/env-type.js +3 -0
  44. package/dist/env/env-validation-schema.d.ts +6 -0
  45. package/dist/env/env-validation-schema.js +113 -0
  46. package/dist/env/index.d.ts +4 -0
  47. package/dist/env/index.js +13 -0
  48. package/dist/formatter/formatter-interface.d.ts +3 -0
  49. package/dist/formatter/formatter-interface.js +2 -0
  50. package/dist/formatter/index.d.ts +4 -0
  51. package/dist/formatter/index.js +9 -0
  52. package/dist/formatter/json-formatter.d.ts +13 -0
  53. package/dist/formatter/json-formatter.js +28 -0
  54. package/dist/formatter/jsonp-formatter.d.ts +13 -0
  55. package/dist/formatter/jsonp-formatter.js +29 -0
  56. package/dist/formatter/report-serializer.d.ts +20 -0
  57. package/dist/formatter/report-serializer.js +92 -0
  58. package/dist/index.d.ts +14 -0
  59. package/dist/index.js +30 -0
  60. package/dist/internal/filter-positive-ids.d.ts +17 -0
  61. package/dist/internal/filter-positive-ids.js +38 -0
  62. package/dist/internal/ids-parser.d.ts +9 -0
  63. package/dist/internal/ids-parser.js +21 -0
  64. package/dist/internal/index.d.ts +8 -0
  65. package/dist/internal/index.js +15 -0
  66. package/dist/internal/step-parser.d.ts +11 -0
  67. package/dist/internal/step-parser.js +28 -0
  68. package/dist/internal/suite-file.d.ts +13 -0
  69. package/dist/internal/suite-file.js +16 -0
  70. package/dist/internal/suite-normalizer.d.ts +6 -0
  71. package/dist/internal/suite-normalizer.js +11 -0
  72. package/dist/internal/title.d.ts +5 -0
  73. package/dist/internal/title.js +15 -0
  74. package/dist/models/attachment.d.ts +8 -0
  75. package/dist/models/attachment.js +2 -0
  76. package/dist/models/config/TidenOptionsType.d.ts +33 -0
  77. package/dist/models/config/TidenOptionsType.js +2 -0
  78. package/dist/models/configuration.d.ts +12 -0
  79. package/dist/models/configuration.js +2 -0
  80. package/dist/models/error.d.ts +7 -0
  81. package/dist/models/error.js +24 -0
  82. package/dist/models/execution-sum.d.ts +6 -0
  83. package/dist/models/execution-sum.js +2 -0
  84. package/dist/models/host-data.d.ts +12 -0
  85. package/dist/models/host-data.js +2 -0
  86. package/dist/models/index.d.ts +11 -0
  87. package/dist/models/index.js +15 -0
  88. package/dist/models/report.d.ts +14 -0
  89. package/dist/models/report.js +2 -0
  90. package/dist/models/short-result.d.ts +7 -0
  91. package/dist/models/short-result.js +2 -0
  92. package/dist/models/stats.d.ts +9 -0
  93. package/dist/models/stats.js +2 -0
  94. package/dist/models/step-data.d.ts +19 -0
  95. package/dist/models/step-data.js +2 -0
  96. package/dist/models/step-execution.d.ts +13 -0
  97. package/dist/models/step-execution.js +23 -0
  98. package/dist/models/test-execution.d.ts +20 -0
  99. package/dist/models/test-execution.js +32 -0
  100. package/dist/models/test-result.d.ts +44 -0
  101. package/dist/models/test-result.js +50 -0
  102. package/dist/models/test-step.d.ts +18 -0
  103. package/dist/models/test-step.js +53 -0
  104. package/dist/options/composeOptions.d.ts +8 -0
  105. package/dist/options/composeOptions.js +12 -0
  106. package/dist/options/index.d.ts +3 -0
  107. package/dist/options/index.js +7 -0
  108. package/dist/options/mode-enum.d.ts +8 -0
  109. package/dist/options/mode-enum.js +12 -0
  110. package/dist/options/options-type.d.ts +38 -0
  111. package/dist/options/options-type.js +3 -0
  112. package/dist/profilers/abstract-profiler.d.ts +5 -0
  113. package/dist/profilers/abstract-profiler.js +6 -0
  114. package/dist/profilers/fetch-interceptor.d.ts +60 -0
  115. package/dist/profilers/fetch-interceptor.js +277 -0
  116. package/dist/profilers/http-interceptor.d.ts +76 -0
  117. package/dist/profilers/http-interceptor.js +252 -0
  118. package/dist/profilers/index.d.ts +5 -0
  119. package/dist/profilers/index.js +11 -0
  120. package/dist/profilers/network-profiler.d.ts +61 -0
  121. package/dist/profilers/network-profiler.js +94 -0
  122. package/dist/reporters/abstract-reporter.d.ts +68 -0
  123. package/dist/reporters/abstract-reporter.js +78 -0
  124. package/dist/reporters/index.d.ts +3 -0
  125. package/dist/reporters/index.js +9 -0
  126. package/dist/reporters/report-reporter.d.ts +50 -0
  127. package/dist/reporters/report-reporter.js +167 -0
  128. package/dist/reporters/run-reporter.d.ts +65 -0
  129. package/dist/reporters/run-reporter.js +155 -0
  130. package/dist/reporters/shared/fallback-coordinator.d.ts +47 -0
  131. package/dist/reporters/shared/fallback-coordinator.js +119 -0
  132. package/dist/reporters/shared/run-constants.d.ts +11 -0
  133. package/dist/reporters/shared/run-constants.js +14 -0
  134. package/dist/state/state.d.ts +16 -0
  135. package/dist/state/state.js +70 -0
  136. package/dist/steps/step.d.ts +16 -0
  137. package/dist/steps/step.js +86 -0
  138. package/dist/tiden.d.ts +48 -0
  139. package/dist/tiden.js +223 -0
  140. package/dist/utils/disabled-exception.d.ts +6 -0
  141. package/dist/utils/disabled-exception.js +10 -0
  142. package/dist/utils/get-package-version.d.ts +5 -0
  143. package/dist/utils/get-package-version.js +25 -0
  144. package/dist/utils/hostData.d.ts +8 -0
  145. package/dist/utils/hostData.js +140 -0
  146. package/dist/utils/is-axios-error.d.ts +6 -0
  147. package/dist/utils/is-axios-error.js +11 -0
  148. package/dist/utils/logger.d.ts +33 -0
  149. package/dist/utils/logger.js +141 -0
  150. package/dist/utils/mimeTypes.d.ts +5 -0
  151. package/dist/utils/mimeTypes.js +50 -0
  152. package/dist/utils/project-mapping-utils.d.ts +17 -0
  153. package/dist/utils/project-mapping-utils.js +29 -0
  154. package/dist/utils/signature.d.ts +11 -0
  155. package/dist/utils/signature.js +34 -0
  156. package/dist/utils/status-mapping-utils.d.ts +14 -0
  157. package/dist/utils/status-mapping-utils.js +45 -0
  158. package/dist/utils/test-status-utils.d.ts +8 -0
  159. package/dist/utils/test-status-utils.js +152 -0
  160. package/dist/utils/tiden-error.d.ts +18 -0
  161. package/dist/utils/tiden-error.js +19 -0
  162. package/dist/utils/token-masker.d.ts +11 -0
  163. package/dist/utils/token-masker.js +26 -0
  164. package/dist/utils/validate-json.d.ts +20 -0
  165. package/dist/utils/validate-json.js +41 -0
  166. package/dist/writer/driver-enum.d.ts +13 -0
  167. package/dist/writer/driver-enum.js +18 -0
  168. package/dist/writer/fs-writer.d.ts +40 -0
  169. package/dist/writer/fs-writer.js +139 -0
  170. package/dist/writer/index.d.ts +3 -0
  171. package/dist/writer/index.js +8 -0
  172. package/dist/writer/writer-interface.d.ts +7 -0
  173. package/dist/writer/writer-interface.js +2 -0
  174. package/package.json +83 -0
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.JsonpFormatter = void 0;
7
+ const strip_ansi_1 = __importDefault(require("strip-ansi"));
8
+ /**
9
+ * @class JsonFormatter
10
+ * @implements FormatterInterface
11
+ */
12
+ class JsonpFormatter {
13
+ space;
14
+ constructor(options = {}) {
15
+ const { space = 4 } = options;
16
+ this.space = space;
17
+ }
18
+ // eslint-disable-next-line @typescript-eslint/require-await
19
+ async format(object) {
20
+ const json = JSON.stringify(object, (key, value) => {
21
+ if (key === 'error' && value instanceof Error) {
22
+ return (0, strip_ansi_1.default)(String(value));
23
+ }
24
+ return value;
25
+ }, this.space);
26
+ return `tidenJsonp(${json});`;
27
+ }
28
+ }
29
+ exports.JsonpFormatter = JsonpFormatter;
@@ -0,0 +1,20 @@
1
+ import { Attachment, TestResultType, TestStepType } from '../models';
2
+ export interface ReportSerializerInterface {
3
+ serializeResult(result: TestResultType): Record<string, unknown>;
4
+ serializeStep(step: TestStepType): Record<string, unknown>;
5
+ serializeAttachment(att: Attachment): Record<string, unknown>;
6
+ }
7
+ /**
8
+ * Transforms internal TestResultType / TestStepType into the Tiden Report
9
+ * spec-compliant JSON (RSLT-01/02, STEP-01/02/03 rules).
10
+ *
11
+ * Pure: no I/O, no logger, no state. Suitable for golden-testing.
12
+ */
13
+ export declare class ReportSerializer implements ReportSerializerInterface {
14
+ serializeResult(result: TestResultType): Record<string, unknown>;
15
+ serializeStep(step: TestStepType): Record<string, unknown>;
16
+ serializeAttachment(att: Attachment): Record<string, unknown>;
17
+ private transformCaseIds;
18
+ private transformGroupParams;
19
+ private serializeStepData;
20
+ }
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportSerializer = void 0;
4
+ const models_1 = require("../models");
5
+ /**
6
+ * Transforms internal TestResultType / TestStepType into the Tiden Report
7
+ * spec-compliant JSON (RSLT-01/02, STEP-01/02/03 rules).
8
+ *
9
+ * Pure: no I/O, no logger, no state. Suitable for golden-testing.
10
+ */
11
+ class ReportSerializer {
12
+ serializeResult(result) {
13
+ const caseIds = this.transformCaseIds(result.case_id);
14
+ const paramGroups = this.transformGroupParams(result.group_params);
15
+ return {
16
+ id: result.id,
17
+ title: result.title,
18
+ signature: result.signature,
19
+ execution: result.execution,
20
+ fields: result.fields,
21
+ attachments: result.attachments.map((a) => this.serializeAttachment(a)),
22
+ steps: result.steps.map((s) => this.serializeStep(s)),
23
+ params: result.params,
24
+ param_groups: paramGroups,
25
+ // The local `report` file format keeps snake_case field names (its own
26
+ // contract, locked by tests) — deliberately independent of the API wire
27
+ // format, which follows the OpenAPI reporter contract models.
28
+ testops_ids: caseIds,
29
+ relations: result.relations,
30
+ muted: result.muted,
31
+ message: result.message,
32
+ tags: result.tags,
33
+ };
34
+ }
35
+ serializeStep(step) {
36
+ const data = this.serializeStepData(step);
37
+ const attachments = step.attachments.map((a) => this.serializeAttachment(a));
38
+ return {
39
+ id: step.id,
40
+ step_type: step.step_type,
41
+ data,
42
+ parent_id: step.parent_id,
43
+ execution: { ...step.execution, attachments },
44
+ steps: step.steps.map((s) => this.serializeStep(s)),
45
+ };
46
+ }
47
+ serializeAttachment(att) {
48
+ return {
49
+ id: att.id,
50
+ file_name: att.file_name,
51
+ mime_type: att.mime_type,
52
+ file_path: att.file_path,
53
+ };
54
+ }
55
+ transformCaseIds(caseId) {
56
+ if (caseId === null)
57
+ return null;
58
+ return Array.isArray(caseId)
59
+ ? caseId
60
+ : [caseId];
61
+ }
62
+ transformGroupParams(groupParams) {
63
+ const keys = Object.keys(groupParams);
64
+ return keys.length === 0 ? [] : [keys];
65
+ }
66
+ serializeStepData(step) {
67
+ const data = { ...step.data };
68
+ if (step.step_type === models_1.StepType.TEXT && 'data' in data) {
69
+ const textData = data;
70
+ return {
71
+ action: textData.action,
72
+ expected_result: textData.expected_result,
73
+ input_data: textData.data,
74
+ };
75
+ }
76
+ if (step.step_type === models_1.StepType.GHERKIN &&
77
+ 'keyword' in data &&
78
+ 'name' in data) {
79
+ const gherkinData = data;
80
+ return {
81
+ action: `${gherkinData.keyword} ${gherkinData.name}`,
82
+ expected_result: null,
83
+ input_data: null,
84
+ };
85
+ }
86
+ if (step.step_type === models_1.StepType.REQUEST && 'request_method' in data) {
87
+ return data;
88
+ }
89
+ return data;
90
+ }
91
+ }
92
+ exports.ReportSerializer = ReportSerializer;
@@ -0,0 +1,14 @@
1
+ export * from './tiden';
2
+ export * from './config';
3
+ export * from './env';
4
+ export * from './formatter';
5
+ export * from './models';
6
+ export * from './options';
7
+ export * from './reporters';
8
+ export * from './writer';
9
+ export * from './utils/get-package-version';
10
+ export * from './utils/mimeTypes';
11
+ export * from './utils/project-mapping-utils';
12
+ export * from './utils/signature';
13
+ export * from './utils/test-status-utils';
14
+ export * from './steps/step';
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./tiden"), exports);
18
+ __exportStar(require("./config"), exports);
19
+ __exportStar(require("./env"), exports);
20
+ __exportStar(require("./formatter"), exports);
21
+ __exportStar(require("./models"), exports);
22
+ __exportStar(require("./options"), exports);
23
+ __exportStar(require("./reporters"), exports);
24
+ __exportStar(require("./writer"), exports);
25
+ __exportStar(require("./utils/get-package-version"), exports);
26
+ __exportStar(require("./utils/mimeTypes"), exports);
27
+ __exportStar(require("./utils/project-mapping-utils"), exports);
28
+ __exportStar(require("./utils/signature"), exports);
29
+ __exportStar(require("./utils/test-status-utils"), exports);
30
+ __exportStar(require("./steps/step"), exports);
@@ -0,0 +1,17 @@
1
+ import { LoggerInterface } from '../utils/logger';
2
+ /**
3
+ * Filter a list of Tiden test case IDs, dropping non-positive (<= 0) and
4
+ * non-finite numbers. Each dropped non-positive ID produces a warning so
5
+ * users can spot accidental "0" IDs in their test code.
6
+ *
7
+ * NaN and non-finite values are dropped silently — they come from upstream
8
+ * parse failures (parseInt('abc') etc.) that are already handled at their
9
+ * source and are not user-facing mistakes worth warning about.
10
+ *
11
+ * Warning routing:
12
+ * - if a logger is provided, it goes through logger.log (INFO level, since
13
+ * the LoggerInterface has no warn level);
14
+ * - otherwise, it falls back to console.warn with a "[tiden] " prefix so the
15
+ * message still reaches the user.
16
+ */
17
+ export declare function filterPositiveIds(ids: number[], logger?: LoggerInterface): number[];
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterPositiveIds = filterPositiveIds;
4
+ /**
5
+ * Filter a list of Tiden test case IDs, dropping non-positive (<= 0) and
6
+ * non-finite numbers. Each dropped non-positive ID produces a warning so
7
+ * users can spot accidental "0" IDs in their test code.
8
+ *
9
+ * NaN and non-finite values are dropped silently — they come from upstream
10
+ * parse failures (parseInt('abc') etc.) that are already handled at their
11
+ * source and are not user-facing mistakes worth warning about.
12
+ *
13
+ * Warning routing:
14
+ * - if a logger is provided, it goes through logger.log (INFO level, since
15
+ * the LoggerInterface has no warn level);
16
+ * - otherwise, it falls back to console.warn with a "[tiden] " prefix so the
17
+ * message still reaches the user.
18
+ */
19
+ function filterPositiveIds(ids, logger) {
20
+ const valid = [];
21
+ for (const n of ids) {
22
+ if (!Number.isFinite(n)) {
23
+ continue;
24
+ }
25
+ if (n <= 0) {
26
+ const message = `Warning: Tiden test case ID must be greater than 0, got "${n}". This ID will be ignored and the result will be sent without it.`;
27
+ if (logger) {
28
+ logger.log(message);
29
+ }
30
+ else {
31
+ console.warn(`[tiden] ${message}`);
32
+ }
33
+ continue;
34
+ }
35
+ valid.push(n);
36
+ }
37
+ return valid;
38
+ }
@@ -0,0 +1,9 @@
1
+ import { LoggerInterface } from '../utils/logger';
2
+ /**
3
+ * Parses a comma-separated string of Tiden IDs into an array of numbers.
4
+ * Whitespace around each entry is trimmed; non-numeric entries are skipped.
5
+ * IDs that are not positive integers (<= 0) are filtered out with a warning.
6
+ *
7
+ * Examples: "1,2,3" → [1, 2, 3], "42" → [42], "" → [].
8
+ */
9
+ export declare function parseTidenIdsFromString(value: string, logger?: LoggerInterface): number[];
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseTidenIdsFromString = parseTidenIdsFromString;
4
+ const filter_positive_ids_1 = require("./filter-positive-ids");
5
+ /**
6
+ * Parses a comma-separated string of Tiden IDs into an array of numbers.
7
+ * Whitespace around each entry is trimmed; non-numeric entries are skipped.
8
+ * IDs that are not positive integers (<= 0) are filtered out with a warning.
9
+ *
10
+ * Examples: "1,2,3" → [1, 2, 3], "42" → [42], "" → [].
11
+ */
12
+ function parseTidenIdsFromString(value, logger) {
13
+ if (!value?.trim()) {
14
+ return [];
15
+ }
16
+ const parsed = value
17
+ .split(',')
18
+ .map((part) => parseInt(part.trim(), 10))
19
+ .filter((n) => !Number.isNaN(n));
20
+ return (0, filter_positive_ids_1.filterPositiveIds)(parsed, logger);
21
+ }
@@ -0,0 +1,8 @@
1
+ export { removeTidenIdsFromTitle } from './title';
2
+ export { extractAndCleanStep } from './step-parser';
3
+ export type { ExtractedStep } from './step-parser';
4
+ export { getFile } from './suite-file';
5
+ export type { FileSuiteNode } from './suite-file';
6
+ export { parseTidenIdsFromString } from './ids-parser';
7
+ export { filterPositiveIds } from './filter-positive-ids';
8
+ export { normalizeSuitePart } from './suite-normalizer';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeSuitePart = exports.filterPositiveIds = exports.parseTidenIdsFromString = exports.getFile = exports.extractAndCleanStep = exports.removeTidenIdsFromTitle = void 0;
4
+ var title_1 = require("./title");
5
+ Object.defineProperty(exports, "removeTidenIdsFromTitle", { enumerable: true, get: function () { return title_1.removeTidenIdsFromTitle; } });
6
+ var step_parser_1 = require("./step-parser");
7
+ Object.defineProperty(exports, "extractAndCleanStep", { enumerable: true, get: function () { return step_parser_1.extractAndCleanStep; } });
8
+ var suite_file_1 = require("./suite-file");
9
+ Object.defineProperty(exports, "getFile", { enumerable: true, get: function () { return suite_file_1.getFile; } });
10
+ var ids_parser_1 = require("./ids-parser");
11
+ Object.defineProperty(exports, "parseTidenIdsFromString", { enumerable: true, get: function () { return ids_parser_1.parseTidenIdsFromString; } });
12
+ var filter_positive_ids_1 = require("./filter-positive-ids");
13
+ Object.defineProperty(exports, "filterPositiveIds", { enumerable: true, get: function () { return filter_positive_ids_1.filterPositiveIds; } });
14
+ var suite_normalizer_1 = require("./suite-normalizer");
15
+ Object.defineProperty(exports, "normalizeSuitePart", { enumerable: true, get: function () { return suite_normalizer_1.normalizeSuitePart; } });
@@ -0,0 +1,11 @@
1
+ export interface ExtractedStep {
2
+ expectedResult: string | null;
3
+ data: string | null;
4
+ cleanedString: string;
5
+ }
6
+ /**
7
+ * Parses a step string for inline `TidenExpRes:` (expected result) and `TidenData:`
8
+ * (data) markers. Returns the extracted parts and the input string with markers
9
+ * removed. If no markers are present, returns nulls and the original string.
10
+ */
11
+ export declare function extractAndCleanStep(input: string): ExtractedStep;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractAndCleanStep = extractAndCleanStep;
4
+ /**
5
+ * Parses a step string for inline `TidenExpRes:` (expected result) and `TidenData:`
6
+ * (data) markers. Returns the extracted parts and the input string with markers
7
+ * removed. If no markers are present, returns nulls and the original string.
8
+ */
9
+ function extractAndCleanStep(input) {
10
+ let expectedResult = null;
11
+ let data = null;
12
+ let cleanedString = input;
13
+ const hasExpectedResult = input.includes('TidenExpRes:');
14
+ const hasData = input.includes('TidenData:');
15
+ if (hasExpectedResult || hasData) {
16
+ const regex = /TidenExpRes:\s*:?\s*(.*?)\s*(?=TidenData:|$)TidenData:\s*:?\s*(.*)?/;
17
+ const match = input.match(regex);
18
+ if (match) {
19
+ expectedResult = match[1]?.trim() ?? null;
20
+ data = match[2]?.trim() ?? null;
21
+ cleanedString = input
22
+ .replace(/TidenExpRes:\s*:?\s*.*?(?=TidenData:|$)/, '')
23
+ .replace(/TidenData:\s*:?\s*.*/, '')
24
+ .trim();
25
+ }
26
+ }
27
+ return { expectedResult, data, cleanedString };
28
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Minimal structural shape compatible with both Mocha's `Suite` and
3
+ * Cypress's runner `Suite`.
4
+ */
5
+ export interface FileSuiteNode {
6
+ file?: string;
7
+ parent?: FileSuiteNode;
8
+ }
9
+ /**
10
+ * Walks up `node.parent` until a node with a non-empty `file` property is
11
+ * reached. Returns the file path, or undefined if no ancestor has one.
12
+ */
13
+ export declare function getFile(node: FileSuiteNode): string | undefined;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFile = getFile;
4
+ /**
5
+ * Walks up `node.parent` until a node with a non-empty `file` property is
6
+ * reached. Returns the file path, or undefined if no ancestor has one.
7
+ */
8
+ function getFile(node) {
9
+ if (node.file) {
10
+ return node.file;
11
+ }
12
+ if (node.parent) {
13
+ return getFile(node.parent);
14
+ }
15
+ return undefined;
16
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Lowercases the input and replaces every whitespace character with an
3
+ * underscore. Used by reporters to normalize suite/title segments before
4
+ * passing them into `generateSignature`.
5
+ */
6
+ export declare function normalizeSuitePart(value: string): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeSuitePart = normalizeSuitePart;
4
+ /**
5
+ * Lowercases the input and replaces every whitespace character with an
6
+ * underscore. Used by reporters to normalize suite/title segments before
7
+ * passing them into `generateSignature`.
8
+ */
9
+ function normalizeSuitePart(value) {
10
+ return value.toLowerCase().replace(/\s/g, '_');
11
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Strips a trailing `(Tiden ID: 1,2,3)` (or `(Tiden ID 1)` without colon) from a test title.
3
+ * Returns the original title untouched if no match is found.
4
+ */
5
+ export declare function removeTidenIdsFromTitle(title: string): string;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeTidenIdsFromTitle = removeTidenIdsFromTitle;
4
+ const TIDEN_ID_TRAILER_REGEXP = /\(Tiden ID:? ([\d,]+)\)$/i;
5
+ /**
6
+ * Strips a trailing `(Tiden ID: 1,2,3)` (or `(Tiden ID 1)` without colon) from a test title.
7
+ * Returns the original title untouched if no match is found.
8
+ */
9
+ function removeTidenIdsFromTitle(title) {
10
+ const match = title.match(TIDEN_ID_TRAILER_REGEXP);
11
+ if (match) {
12
+ return title.replace(match[0], '').trimEnd();
13
+ }
14
+ return title;
15
+ }
@@ -0,0 +1,8 @@
1
+ export interface Attachment {
2
+ file_name: string;
3
+ mime_type: string;
4
+ file_path: string | null;
5
+ content: string | Buffer;
6
+ size: number;
7
+ id: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,33 @@
1
+ export interface TidenOptionsType {
2
+ product: string;
3
+ uploadAttachments?: boolean | undefined;
4
+ api: TidenApiType;
5
+ run: TidenRunType;
6
+ batch?: TidenBatchType;
7
+ defect?: boolean | undefined;
8
+ configurations?: TidenConfigurationType | undefined;
9
+ statusFilter?: string[] | undefined;
10
+ clientMeta?: Record<string, string> | undefined;
11
+ }
12
+ export interface TidenConfigurationType {
13
+ values: TidenConfigurationValueType[];
14
+ }
15
+ export interface TidenConfigurationValueType {
16
+ name: string;
17
+ value: string;
18
+ }
19
+ export interface TidenRunType {
20
+ id?: number | undefined;
21
+ title?: string;
22
+ description?: string;
23
+ complete?: boolean | undefined;
24
+ branch?: string;
25
+ }
26
+ export interface TidenBatchType {
27
+ size?: number | undefined;
28
+ }
29
+ export interface TidenApiType {
30
+ token: string;
31
+ /** Tiden API base URL, taken verbatim (no self-host URL templating). */
32
+ baseUrl: string;
33
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ export interface ConfigurationGroup {
2
+ id: number;
3
+ title: string;
4
+ configurations: ConfigurationItem[];
5
+ }
6
+ export interface ConfigurationItem {
7
+ id: number;
8
+ title: string;
9
+ }
10
+ export interface ConfigurationGroupResponse {
11
+ groups: ConfigurationGroup[];
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export declare class CompoundError {
2
+ message: string | undefined;
3
+ stacktrace: string | undefined;
4
+ constructor();
5
+ addMessage(message: string): void;
6
+ addStacktrace(stacktrace: string): void;
7
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompoundError = void 0;
4
+ class CompoundError {
5
+ message;
6
+ stacktrace;
7
+ constructor() {
8
+ this.message = 'CompoundError: One or more errors occurred. ---\n';
9
+ }
10
+ addMessage(message) {
11
+ this.message += `${message}\n--- End of error message ---\n`;
12
+ }
13
+ addStacktrace(stacktrace) {
14
+ if (!this.stacktrace) {
15
+ this.stacktrace = `${indentAll(stacktrace)}\n--- End of stack trace ---\n`;
16
+ return;
17
+ }
18
+ this.stacktrace += `${indentAll(stacktrace)}\n--- End of stack trace ---\n`;
19
+ }
20
+ }
21
+ exports.CompoundError = CompoundError;
22
+ function indentAll(lines) {
23
+ return lines.split('\n').map(x => ' ' + x).join('\n');
24
+ }
@@ -0,0 +1,6 @@
1
+ export interface ExecutionSum {
2
+ start_time: number;
3
+ end_time: number;
4
+ duration: number;
5
+ cumulative_duration: number;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ export interface HostData {
2
+ system: string;
3
+ machineName: string;
4
+ release: string;
5
+ version: string;
6
+ arch: string;
7
+ language: string;
8
+ packageManager: string;
9
+ framework: string;
10
+ reporter: string;
11
+ commons: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ export { TestResultType } from './test-result';
2
+ export type { Relation, Suite, SuiteData, ProjectCaseMapping } from './test-result';
3
+ export { TestExecution, TestStatusEnum } from './test-execution';
4
+ export { TestStepType, StepType } from './test-step';
5
+ export type { StepRequestData, StepTextData, StepGherkinData } from './step-data';
6
+ export { StepStatusEnum } from './step-execution';
7
+ export type { Attachment } from './attachment';
8
+ export type { Report } from './report';
9
+ export { CompoundError } from './error';
10
+ export type { ConfigurationGroup, ConfigurationItem, ConfigurationGroupResponse } from './configuration';
11
+ export type { TidenOptionsType, TidenApiType, TidenRunType, TidenBatchType, TidenConfigurationType, TidenConfigurationValueType } from './config/TidenOptionsType';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompoundError = exports.StepStatusEnum = exports.StepType = exports.TestStepType = exports.TestStatusEnum = exports.TestExecution = exports.TestResultType = void 0;
4
+ var test_result_1 = require("./test-result");
5
+ Object.defineProperty(exports, "TestResultType", { enumerable: true, get: function () { return test_result_1.TestResultType; } });
6
+ var test_execution_1 = require("./test-execution");
7
+ Object.defineProperty(exports, "TestExecution", { enumerable: true, get: function () { return test_execution_1.TestExecution; } });
8
+ Object.defineProperty(exports, "TestStatusEnum", { enumerable: true, get: function () { return test_execution_1.TestStatusEnum; } });
9
+ var test_step_1 = require("./test-step");
10
+ Object.defineProperty(exports, "TestStepType", { enumerable: true, get: function () { return test_step_1.TestStepType; } });
11
+ Object.defineProperty(exports, "StepType", { enumerable: true, get: function () { return test_step_1.StepType; } });
12
+ var step_execution_1 = require("./step-execution");
13
+ Object.defineProperty(exports, "StepStatusEnum", { enumerable: true, get: function () { return step_execution_1.StepStatusEnum; } });
14
+ var error_1 = require("./error");
15
+ Object.defineProperty(exports, "CompoundError", { enumerable: true, get: function () { return error_1.CompoundError; } });
@@ -0,0 +1,14 @@
1
+ import { HostData } from './host-data';
2
+ import { ShortResult } from './short-result';
3
+ import { Stats } from './stats';
4
+ import { ExecutionSum } from './execution-sum';
5
+ export interface Report {
6
+ environment: string;
7
+ execution: ExecutionSum;
8
+ host_data: HostData;
9
+ results: ShortResult[];
10
+ stats: Stats;
11
+ suites: string[];
12
+ threads: string[];
13
+ title: string;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export interface ShortResult {
2
+ id: string;
3
+ title: string;
4
+ status: string;
5
+ duration: number;
6
+ thread: string | null;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface Stats {
2
+ passed: number;
3
+ failed: number;
4
+ skipped: number;
5
+ blocked: number;
6
+ invalid: number;
7
+ muted: number;
8
+ total: number;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });