@testomatio/reporter 2.9.3-beta.4-allure-links → 2.9.3

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.
@@ -1,217 +0,0 @@
1
- export default AllureReader;
2
- declare class AllureReader {
3
- constructor(opts?: {});
4
- requestParams: {
5
- apiKey: any;
6
- url: any;
7
- title: string;
8
- env: string;
9
- group_title: string;
10
- batchMode: "manual";
11
- };
12
- runId: any;
13
- opts: {};
14
- withPackage: any;
15
- store: {};
16
- pipesPromise: Promise<any[]>;
17
- _tests: any[];
18
- stats: {};
19
- suites: {};
20
- uploader: S3Uploader;
21
- version: any;
22
- set tests(value: any[]);
23
- get tests(): any[];
24
- createRun(): Promise<any[]>;
25
- pipes: any;
26
- parse(resultsPattern: any): {};
27
- parseContainerFiles(containerFiles: any): void;
28
- processAllureResult(result: any, resultsDir: any): {
29
- rid: any;
30
- title: any;
31
- status: any;
32
- suite_title: any;
33
- file: string;
34
- run_time: number;
35
- steps: any;
36
- message: any;
37
- stack: any;
38
- meta: {};
39
- links: {
40
- label: string;
41
- }[];
42
- artifacts: any[];
43
- create: boolean;
44
- overwrite: boolean;
45
- };
46
- mapStatus(status: any): any;
47
- /**
48
- * Map an Allure step status to the Testomat.io Step status enum
49
- * (`passed | failed | none | custom`, see testomat-api-definition.yml).
50
- *
51
- * Allure marks a step `broken` when it threw an unexpected error — that is a
52
- * failure for reporting purposes, matching how `mapStatus` treats tests.
53
- * `skipped` and anything unknown/absent become `none` (the neutral value),
54
- * since the step enum has no `skipped`.
55
- *
56
- * @param {string} status - Allure step status
57
- * @returns {'passed'|'failed'|'none'} Testomat.io step status
58
- */
59
- mapStepStatus(status: string): "passed" | "failed" | "none";
60
- extractSuiteTitle(result: any): any;
61
- stripNamespace(suiteName: any): any;
62
- extractFile(result: any): string;
63
- getFileExtension(result: any): any;
64
- extractMeta(result: any): {};
65
- extractLinks(result: any): {
66
- label: string;
67
- }[];
68
- /**
69
- * Extract all Testomat.io test ids from Allure links so reported results match
70
- * existing cases instead of creating duplicates.
71
- *
72
- * A test may carry several `@TmsLink`s (e.g. `@TmsLinks(@TmsLink("…"), @TmsLink("…"))`),
73
- * each producing a link with `type: "tms"`. Some exporters omit the type but still point
74
- * the link URL at a Testomat.io test page; both are accepted. The link `name` is used as
75
- * the id (falling back to the id segment of a Testomat.io URL). Ids are normalized and
76
- * de-duplicated, preserving order so the first one stays the primary `test_id`.
77
- *
78
- * @param {object} result - Parsed Allure result JSON
79
- * @returns {string[]} Normalized test ids (possibly empty)
80
- */
81
- extractTmsIds(result: object): string[];
82
- /**
83
- * The primary Testomat.io test id (the first `@TmsLink`), or null when there is none.
84
- *
85
- * @param {object} result - Parsed Allure result JSON
86
- * @returns {string|null}
87
- */
88
- extractTestId(result: object): string | null;
89
- /**
90
- * Attach additional linked test cases to a reported test as `{ test: id }` link entries
91
- * (the same shape `linkTest()` uses), so a single result updates every case it is linked
92
- * to — not just the primary `test_id`. Existing links are preserved; duplicates skipped.
93
- *
94
- * @param {object} test - converted test
95
- * @param {string[]} ids - additional test ids to link
96
- */
97
- addLinkedTestIds(test: object, ids: string[]): void;
98
- /**
99
- * Normalize a value into a Testomat.io test id.
100
- *
101
- * Testomat.io test ids are exactly **8 word characters**. The value may arrive bare
102
- * (`1a2b3c4d`), or carrying the `T` / `@T` markers Testomat uses in code and titles
103
- * (`T1a2b3c4d`, `@T1a2b3c4d`). The markers are removed only when doing so still leaves
104
- * a valid 8-char id, so a real id that happens to start with `T` is preserved.
105
- *
106
- * Anything that does not resolve to a valid 8-char id — a numeric Allure TestOps id
107
- * like `12345`, a JIRA key, a 6-digit TMS number — is rejected (returns null) so we
108
- * never send an unmatchable id that would create duplicates.
109
- *
110
- * @param {string|number|null|undefined} value
111
- * @returns {string|null} The bare 8-char id, or null when the value is not a valid id
112
- */
113
- normalizeTestId(value: string | number | null | undefined): string | null;
114
- /**
115
- * Recover a Testomat.io test id from the `@TmsLink("…")` annotation in test source.
116
- *
117
- * Allure does not emit link annotations for skipped (`@Ignore` / `@Disabled`) tests,
118
- * so their results carry no `tms` link and `extractTestId` returns null — which makes
119
- * the server create a duplicate case. The id still lives in the source, on the test
120
- * method, so we read it from there as a fallback.
121
- *
122
- * The lookup is method-scoped: we locate the test method declaration by name, collect
123
- * its annotation/comment block (the lines directly above it, up to the previous code
124
- * construct) and read every `@TmsLink` from it — so an unrelated method's annotation can
125
- * never be picked up. Both `@TmsLink("…")` and the container forms
126
- * `@TmsLinks(@TmsLink("…"), @TmsLink("…"))` (single- or multi-line) are supported.
127
- *
128
- * @param {string} contents - full source file
129
- * @param {object} test - converted test (uses `title`)
130
- * @returns {string[]} normalized 8-char ids in source order (possibly empty)
131
- */
132
- extractTmsIdsFromSource(contents: string, test: object): string[];
133
- /**
134
- * The primary `@TmsLink` id for a test method in source, or null. Convenience wrapper
135
- * around {@link extractTmsIdsFromSource}.
136
- *
137
- * @param {string} contents - full source file
138
- * @param {object} test - converted test (uses `title`)
139
- * @returns {string|null}
140
- */
141
- extractTmsIdFromSource(contents: string, test: object): string | null;
142
- convertSteps(steps: any, depth?: number): any;
143
- /**
144
- * Check whether any step in the given (already converted) subtree already
145
- * carries an `error`. Used to keep the failure message on the deepest failed
146
- * step only, instead of repeating it on every ancestor in the failure chain.
147
- *
148
- * @param {Array<object>|undefined} steps - converted child steps
149
- * @returns {boolean}
150
- */
151
- subtreeHasError(steps: Array<object> | undefined): boolean;
152
- /**
153
- * Build the `error` payload for a failed step from its Allure `statusDetails`.
154
- *
155
- * Allure stores the failure message and stack trace (which includes the failing
156
- * source line) in `statusDetails` on the step itself. We only surface it for
157
- * failed/broken steps — passing or skipped steps carry no error. Returns null
158
- * when there is no usable failure information so the field is omitted entirely.
159
- *
160
- * @param {object} step - Allure step
161
- * @returns {{message: string, stack: string}|null}
162
- */
163
- extractStepError(step: object): {
164
- message: string;
165
- stack: string;
166
- } | null;
167
- calculateRunTime(item: any): number;
168
- convertParameters(parameters: any): {};
169
- combineRetryAttempts(attempts: any): any;
170
- calculateStats(): {};
171
- fetchSourceCode(): void;
172
- getLanguage(): any;
173
- /**
174
- * Link tests to their Testomat.io cases by reading `@TmsLink` from source for tests that
175
- * carry no `{ test: … }` link yet. This rescues skipped (`@Ignore` / `@Disabled`) tests,
176
- * whose Allure results drop the `@TmsLink` link and would otherwise create duplicate
177
- * cases. Every `@TmsLink` on the method is linked (consistent with executed tests); the
178
- * `test_id` is left untouched — links and test_id are separate concerns.
179
- *
180
- * Opt-in: only runs when `--java-tests` (a source root) is provided. The source files are
181
- * indexed once by basename; for each not-yet-linked test we read the candidate file(s)
182
- * matching its `testFile` / class name and parse the method's `@TmsLink`(s).
183
- */
184
- recoverTmsLinksFromSource(): void;
185
- /**
186
- * Fallback: when a test has no `test_id`, adopt the first linked case (`@TmsLink`) as its
187
- * `test_id` so it matches an existing case instead of creating a method-named duplicate.
188
- *
189
- * Runs after `fetchSourceCode`, so a native Testomat.io id parsed from source always wins.
190
- * The id stays in `links` as well — every linked case is still updated; this only gives the
191
- * test a primary identity to match on.
192
- */
193
- applyPrimaryTestIdFromLinks(): void;
194
- /**
195
- * Build (and cache) a basename -> [absolute paths] index of source files under `root`.
196
- * Walks synchronously, skipping common build/dependency directories.
197
- *
198
- * @param {string} root
199
- * @returns {Map<string, string[]>}
200
- */
201
- indexSourceFiles(root: string): Map<string, string[]>;
202
- _sourceIndex: Map<any, any>;
203
- /**
204
- * Candidate source file paths for a test, looked up in the basename index.
205
- * Uses the `testFile` meta label (e.g. `Foo.kt`) and the class name from `file`,
206
- * trying both `.kt` and `.java` extensions. Ambiguity (same basename in several
207
- * dirs) is harmless: only the file that actually declares the method will match.
208
- *
209
- * @param {object} t
210
- * @param {Map<string, string[]>} index
211
- * @returns {string[]}
212
- */
213
- sourceCandidatesForTest(t: object, index: Map<string, string[]>): string[];
214
- uploadArtifacts(): Promise<void>;
215
- uploadData(): Promise<any[]>;
216
- }
217
- import { S3Uploader } from './uploader.js';