@testomatio/reporter 2.19.0-beta → 2.20.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 (54) hide show
  1. package/lib/adapter/codecept.js +1 -0
  2. package/lib/adapter/cucumber/current.js +1 -0
  3. package/lib/adapter/cypress-plugin/index.js +1 -0
  4. package/lib/adapter/e2e.d.ts +49 -0
  5. package/lib/adapter/e2e.js +250 -0
  6. package/lib/adapter/jasmine.js +1 -0
  7. package/lib/adapter/jest.js +1 -0
  8. package/lib/adapter/mocha.d.ts +4 -1
  9. package/lib/adapter/mocha.js +123 -122
  10. package/lib/adapter/nightwatch.js +1 -0
  11. package/lib/adapter/playwright.js +1 -0
  12. package/lib/adapter/vitest.js +1 -0
  13. package/lib/adapter/webdriver.js +1 -0
  14. package/lib/allureReader.d.ts +4 -1
  15. package/lib/allureReader.js +2 -1
  16. package/lib/bin/cli.js +32 -13
  17. package/lib/client.d.ts +1 -0
  18. package/lib/client.js +12 -3
  19. package/lib/data-storage.js +4 -3
  20. package/lib/pipe/bitbucket.js +5 -1
  21. package/lib/pipe/github.js +5 -1
  22. package/lib/pipe/gitlab.js +5 -1
  23. package/lib/pipe/testomatio.js +17 -1
  24. package/lib/replay.js +1 -0
  25. package/lib/uploader.d.ts +1 -0
  26. package/lib/uploader.js +21 -1
  27. package/lib/utils/pipe_utils.d.ts +32 -3
  28. package/lib/utils/pipe_utils.js +82 -4
  29. package/lib/xmlReader.js +2 -0
  30. package/package.json +7 -2
  31. package/src/adapter/codecept.js +2 -0
  32. package/src/adapter/cucumber/current.js +2 -0
  33. package/src/adapter/cypress-plugin/index.js +2 -0
  34. package/src/adapter/e2e.js +245 -0
  35. package/src/adapter/jasmine.js +2 -0
  36. package/src/adapter/jest.js +2 -0
  37. package/src/adapter/mocha.js +146 -145
  38. package/src/adapter/nightwatch.js +2 -0
  39. package/src/adapter/playwright.js +2 -0
  40. package/src/adapter/vitest.js +2 -0
  41. package/src/adapter/webdriver.js +2 -0
  42. package/src/allureReader.js +2 -1
  43. package/src/bin/cli.js +30 -11
  44. package/src/client.js +11 -3
  45. package/src/data-storage.js +4 -3
  46. package/src/pipe/bitbucket.js +7 -1
  47. package/src/pipe/github.js +7 -1
  48. package/src/pipe/gitlab.js +7 -1
  49. package/src/pipe/testomatio.js +27 -1
  50. package/src/replay.js +1 -0
  51. package/src/uploader.js +30 -1
  52. package/src/utils/pipe_utils.js +85 -4
  53. package/src/xmlReader.js +3 -0
  54. package/types/types.d.ts +1 -0
@@ -0,0 +1,245 @@
1
+ import path from 'path';
2
+ import createDebugMessages from 'debug';
3
+ import TestomatioClient from '../client.js';
4
+ import { STATUS, SCREENSHOTS_ON_STEPS } from '../constants.js';
5
+ import { getTestomatIdFromTestTitle, truncate } from '../utils/utils.js';
6
+ import { formatStep, addStatusToStep, addArtifactsToStep } from './utils/step-formatter.js';
7
+ import { log } from '../utils/log.js';
8
+
9
+ const debug = createDebugMessages('@testomatio/reporter:adapter-e2e');
10
+
11
+ /**
12
+ * Reporter for the e2e framework (https://github.com/tester-army/e2e).
13
+ * Add it to `reporters` in `e2e.config.ts`: `reporters: ['list', testomatio()]`.
14
+ *
15
+ * The config is loaded by every worker, so the client is created only inside
16
+ * handlers, which run in the runner process.
17
+ *
18
+ * @param {{ apiKey?: string }} [options]
19
+ */
20
+ export function testomatio(options = {}) {
21
+ let client = null;
22
+ let runPromise = null;
23
+
24
+ function getClient() {
25
+ if (!client) client = new TestomatioClient({ apiKey: options.apiKey });
26
+ return client;
27
+ }
28
+
29
+ function startRun() {
30
+ if (!runPromise) {
31
+ runPromise = getClient()
32
+ .createRun()
33
+ .catch(err => log.error('Failed to create Testomat.io run:', err?.message || err));
34
+ }
35
+ return runPromise;
36
+ }
37
+
38
+ return {
39
+ name: 'testomatio',
40
+
41
+ onEvent(event) {
42
+ try {
43
+ if (event?.type === 'run-started') startRun();
44
+ } catch (err) {
45
+ debug('onEvent failed', err);
46
+ }
47
+ },
48
+
49
+ async onRunFinished(run, signal) {
50
+ const reporter = getClient();
51
+ await startRun();
52
+
53
+ const { report, artifactsRoot } = run;
54
+ const groups = new Map((report.run.serialGroups || []).map(group => [group.id, group]));
55
+
56
+ const promises = [];
57
+ for (const result of report.run.results) {
58
+ if (signal?.aborted) break;
59
+ // results left out by `--last-failed` belong to the previous run
60
+ if (result.selected === false) continue;
61
+ const { status, data } = toTestData(result, groups, artifactsRoot);
62
+ promises.push(reporter.addTestRun(status, data));
63
+ }
64
+ await Promise.all(promises);
65
+
66
+ const duration = (Date.parse(report.run.finishedAt) - Date.parse(report.run.startedAt)) / 1000;
67
+ await reporter.updateRunStatus(runStatus(report.run.status), { duration });
68
+
69
+ const runUrl = reporter.pipeStore?.runUrl;
70
+ if (runUrl) return [{ label: 'Testomat.io', text: runUrl }];
71
+ },
72
+ };
73
+ }
74
+
75
+ /**
76
+ * Converts one report-1 result into Testomat.io test data.
77
+ * Only the final attempt is reported; earlier attempts are counted as retries.
78
+ */
79
+ export function toTestData(result, groups, artifactsRoot) {
80
+ const attempts = attemptsOf(result, groups);
81
+ const final = attempts.at(-1);
82
+ const titlePath = [...result.titlePath];
83
+ const title = titlePath.pop();
84
+
85
+ let suiteTitle = titlePath.join(' › ');
86
+ if (!suiteTitle) suiteTitle = path.basename(result.file);
87
+
88
+ const meta = {
89
+ target: result.targetId,
90
+ platform: result.platform,
91
+ browser: final?.environment?.browser,
92
+ };
93
+ if (result.agent && result.agent !== 'default') meta.agent = result.agent;
94
+ if (result.repeat) meta.repeat = result.repeat;
95
+ if (attempts.length > 1) meta.retryCount = attempts.length - 1;
96
+ if (result.status === 'flaky') meta.isFlaky = true;
97
+
98
+ const filesById = new Map();
99
+ for (const artifact of final?.artifacts || []) {
100
+ if (artifact.path) {
101
+ filesById.set(artifact.id, {
102
+ path: path.join(artifactsRoot, artifact.path),
103
+ type: artifact.mediaType,
104
+ title: artifact.kind,
105
+ });
106
+ } else if (artifact.url) {
107
+ // hosted engines keep videos remotely
108
+ meta[artifact.kind] = artifact.url;
109
+ }
110
+ }
111
+ const files = [...filesById.values()];
112
+
113
+ const steps = (final?.steps || []).map(step => toStep(step, filesById));
114
+
115
+ const data = {
116
+ rid: result.id,
117
+ title,
118
+ suite_title: suiteTitle,
119
+ file: result.file,
120
+ test_id: getTestomatIdFromTestTitle(title),
121
+ tags: result.tags || [],
122
+ time: final?.durationMs || 0,
123
+ timestamp: timestampOf(final),
124
+ error: toError(final?.error, final?.secondaryErrors),
125
+ steps: steps.length ? steps : undefined,
126
+ logs: logsOf(result, final),
127
+ files: files.length ? files : undefined,
128
+ meta,
129
+ };
130
+
131
+ return { status: testStatus(result.status), data };
132
+ }
133
+
134
+ /** Attempts of a result; a serial member keeps its part of the group's attempts. */
135
+ function attemptsOf(result, groups) {
136
+ if (!result.serialGroupId) return result.attempts || [];
137
+ const groupAttempts = groups.get(result.serialGroupId)?.attempts || [];
138
+ return groupAttempts.map(attempt => {
139
+ const member = attempt.members?.find(candidate => candidate.testId === result.testId);
140
+ return {
141
+ status: member?.status || attempt.status,
142
+ error: member?.error || attempt.error,
143
+ steps: member?.steps || [],
144
+ appLog: member?.appLog || [],
145
+ skip: member?.skip,
146
+ durationMs: member?.durationMs,
147
+ startedAt: member?.startedAt || attempt.startedAt,
148
+ artifacts: attempt.artifacts || [],
149
+ secondaryErrors: [...(member?.secondaryErrors || []), ...(attempt.secondaryErrors || [])],
150
+ environment: attempt.environment,
151
+ };
152
+ });
153
+ }
154
+
155
+ function timestampOf(attempt) {
156
+ if (!attempt?.startedAt) return undefined;
157
+ return Date.parse(attempt.startedAt);
158
+ }
159
+
160
+ function testStatus(status) {
161
+ if (status === 'passed' || status === 'flaky') return STATUS.PASSED;
162
+ if (status === 'skipped') return STATUS.SKIPPED;
163
+ // failed, timed-out, interrupted: the test reached no passing verdict
164
+ return STATUS.FAILED;
165
+ }
166
+
167
+ function runStatus(status) {
168
+ if (status === 'passed') return STATUS.PASSED;
169
+ return STATUS.FAILED;
170
+ }
171
+
172
+ function toError(error, secondaryErrors = []) {
173
+ if (!error) return undefined;
174
+ /** @type {Error & { expected?: string, actual?: string }} */
175
+ const err = new Error(error.message);
176
+ err.name = error.code;
177
+ err.stack = `${error.code}: ${error.message}\n${error.stack || sourceFrame(error.source)}`;
178
+ if (error.details?.expected && error.details?.observed) {
179
+ err.expected = error.details.expected;
180
+ err.actual = error.details.observed;
181
+ }
182
+ for (const secondary of secondaryErrors) {
183
+ err.stack += `\n\nAlso failed (${secondary.phase || secondary.category}) ${secondary.code}: ${secondary.message}`;
184
+ }
185
+ return err;
186
+ }
187
+
188
+ function sourceFrame(source) {
189
+ if (!source) return '';
190
+ return ` at ${source.file}:${source.line}:${source.column}`;
191
+ }
192
+
193
+ function toStep(step, filesById) {
194
+ let category = 'user';
195
+ if (step.phase === 'beforeEach' || step.phase === 'afterEach') category = 'hook';
196
+
197
+ let title = step.api;
198
+ if (step.label) title = `${step.api} ${step.label}`;
199
+
200
+ const formatted = formatStep({
201
+ category,
202
+ title,
203
+ duration: step.durationMs,
204
+ log: stepLog(step),
205
+ });
206
+
207
+ let status = 'failed';
208
+ if (step.status === 'passed') status = 'passed';
209
+ addStatusToStep(formatted, status, step.error);
210
+
211
+ if (step.error) {
212
+ formatted.error = { message: truncate(`${step.error.code}: ${step.error.message}`, 250) };
213
+ }
214
+
215
+ if (SCREENSHOTS_ON_STEPS) {
216
+ const screenshot = (step.artifacts || []).map(id => filesById.get(id)).find(file => file?.type === 'image/png');
217
+ if (screenshot) addArtifactsToStep(formatted, { screenshot: screenshot.path });
218
+ }
219
+
220
+ return formatted;
221
+ }
222
+
223
+ /** Agent reasoning and non-binary step statuses, which a passed/failed step would lose. */
224
+ function stepLog(step) {
225
+ const lines = [];
226
+ if (step.status !== 'passed' && step.status !== 'failed') lines.push(`status: ${step.status}`);
227
+ if (step.explanation) lines.push(step.explanation);
228
+ for (const event of step.events || []) {
229
+ if (event.reasoning) lines.push(event.reasoning);
230
+ }
231
+ return lines.join('\n');
232
+ }
233
+
234
+ function logsOf(result, final) {
235
+ const lines = [];
236
+ const skip = final?.skip || result.skip;
237
+ if (skip) lines.push(`Skipped (${skip.cause}): ${skip.reason}`);
238
+ if (final?.appLog?.length) {
239
+ lines.push('App log:');
240
+ for (const line of final.appLog) lines.push(`[${line.source}] ${line.level}: ${line.text}`);
241
+ }
242
+ return lines.join('\n');
243
+ }
244
+
245
+ export default testomatio;
@@ -2,6 +2,8 @@ import TestomatClient from '../client.js';
2
2
  import { getTestomatIdFromTestTitle, ansiRegExp } from '../utils/utils.js';
3
3
  import { STATUS } from '../constants.js';
4
4
 
5
+ global.TESTOMATIO_ADAPTER = 'jasmine';
6
+
5
7
  class JasmineReporter {
6
8
  constructor(options) {
7
9
  this.testTimeMap = {};
@@ -8,6 +8,8 @@ import createDebugMessages from 'debug';
8
8
 
9
9
  const debug = createDebugMessages('@testomatio/reporter:adapter-jest');
10
10
 
11
+ global.TESTOMATIO_ADAPTER = 'jest';
12
+
11
13
  export class JestReporter {
12
14
  constructor(globalConfig, options) {
13
15
  this._globalConfig = globalConfig;
@@ -6,6 +6,8 @@ import { config } from '../config.js';
6
6
  import { services } from '../services/index.js';
7
7
  import pc from 'picocolors';
8
8
 
9
+ global.TESTOMATIO_ADAPTER = 'mocha';
10
+
9
11
  const {
10
12
  EVENT_RUN_BEGIN,
11
13
  EVENT_RUN_END,
@@ -18,157 +20,160 @@ const {
18
20
  EVENT_TEST_END,
19
21
  } = Mocha.Runner.constants;
20
22
 
21
- function MochaReporter(runner, opts) {
22
- Mocha.reporters.Base.call(this, runner);
23
- let passes = 0;
24
- let failures = 0;
25
- let skipped = 0;
26
- // let artifactStore;
27
-
28
- const apiKey = opts?.reporterOptions?.apiKey || config.TESTOMATIO;
29
-
30
- const client = new TestomatClient({ apiKey });
31
-
32
- // Track hook failures
33
- const hookFailures = new Map();
34
-
35
- runner.on(EVENT_RUN_BEGIN, () => {
36
- client.createRun();
37
-
38
- // clear dir with artifacts/logs
39
- fileSystem.clearDir(TESTOMAT_TMP_STORAGE_DIR);
40
- });
41
-
42
- runner.on(EVENT_SUITE_BEGIN, async suite => {
43
- services.setContext(suite.fullTitle());
44
- });
45
-
46
- runner.on(EVENT_SUITE_END, async suite => {
47
- if (hookFailures.has(suite.fullTitle())) {
48
- const { error, suiteTitle } = hookFailures.get(suite.fullTitle());
49
-
50
- for (const test of suite.tests) {
51
- if (test.state === 'pending' || !test.state) {
52
- const testId = getTestomatIdFromTestTitle(test.title);
53
- const artifacts = services.artifacts.get(test.fullTitle());
54
- const keyValues = services.keyValues.get(test.fullTitle());
55
- const links = services.links.get(test.fullTitle());
56
-
57
- client.addTestRun(STATUS.FAILED, {
58
- error,
59
- suite_title: suiteTitle || suite.title,
60
- file: suite.file,
61
- test_id: testId,
62
- title: test.title,
63
- code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
64
- time: 0,
65
- manuallyAttachedArtifacts: artifacts,
66
- meta: keyValues,
67
- links,
68
- });
23
+ // ES class so it works with mocha 12, where Base is a class and utils.inherits is gone
24
+ class MochaReporter extends Mocha.reporters.Base {
25
+ constructor(runner, opts) {
26
+ super(runner, opts);
27
+ let passes = 0;
28
+ let failures = 0;
29
+ let skipped = 0;
30
+ // let artifactStore;
31
+
32
+ const apiKey = opts?.reporterOptions?.apiKey || config.TESTOMATIO;
33
+
34
+ const client = new TestomatClient({ apiKey });
35
+
36
+ // Track hook failures
37
+ const hookFailures = new Map();
38
+
39
+ runner.on(EVENT_RUN_BEGIN, () => {
40
+ client.createRun();
41
+
42
+ // clear dir with artifacts/logs
43
+ fileSystem.clearDir(TESTOMAT_TMP_STORAGE_DIR);
44
+ });
45
+
46
+ runner.on(EVENT_SUITE_BEGIN, async suite => {
47
+ services.setContext(suite.fullTitle());
48
+ });
49
+
50
+ runner.on(EVENT_SUITE_END, async suite => {
51
+ if (hookFailures.has(suite.fullTitle())) {
52
+ const { error, suiteTitle } = hookFailures.get(suite.fullTitle());
53
+
54
+ for (const test of suite.tests) {
55
+ if (test.state === 'pending' || !test.state) {
56
+ const testId = getTestomatIdFromTestTitle(test.title);
57
+ const artifacts = services.artifacts.get(test.fullTitle());
58
+ const keyValues = services.keyValues.get(test.fullTitle());
59
+ const links = services.links.get(test.fullTitle());
60
+
61
+ client.addTestRun(STATUS.FAILED, {
62
+ error,
63
+ suite_title: suiteTitle || suite.title,
64
+ file: suite.file,
65
+ test_id: testId,
66
+ title: test.title,
67
+ code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
68
+ time: 0,
69
+ manuallyAttachedArtifacts: artifacts,
70
+ meta: keyValues,
71
+ links,
72
+ });
73
+ }
69
74
  }
70
75
  }
71
- }
72
-
73
- services.setContext(null);
74
- });
75
-
76
- runner.on(EVENT_TEST_BEGIN, async test => {
77
- services.setContext(test.fullTitle());
78
- });
79
-
80
- runner.on(EVENT_TEST_END, async () => {
81
- services.setContext(null);
82
- });
83
-
84
- runner.on(EVENT_TEST_PASS, async test => {
85
- passes += 1;
86
-
87
- console.log(pc.bold(pc.green('✔')), test.fullTitle());
88
- const testId = getTestomatIdFromTestTitle(test.title);
89
-
90
- const logs = getTestLogs(test);
91
- const artifacts = services.artifacts.get(test.fullTitle());
92
- const keyValues = services.keyValues.get(test.fullTitle());
93
- const links = services.links.get(test.fullTitle());
94
-
95
- client.addTestRun(STATUS.PASSED, {
96
- test_id: testId,
97
- suite_title: getSuiteTitle(test),
98
- title: getTestName(test),
99
- code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
100
- file: getFile(test),
101
- time: test.duration,
102
- logs,
103
- manuallyAttachedArtifacts: artifacts,
104
- meta: keyValues,
105
- links,
76
+
77
+ services.setContext(null);
78
+ });
79
+
80
+ runner.on(EVENT_TEST_BEGIN, async test => {
81
+ services.setContext(test.fullTitle());
82
+ });
83
+
84
+ runner.on(EVENT_TEST_END, async () => {
85
+ services.setContext(null);
106
86
  });
107
- });
108
-
109
- runner.on(EVENT_TEST_PENDING, test => {
110
- skipped += 1;
111
- console.log('skip: %s', test.fullTitle());
112
- const testId = getTestomatIdFromTestTitle(test.title);
113
- const artifacts = services.artifacts.get(test.fullTitle());
114
- const keyValues = services.keyValues.get(test.fullTitle());
115
- const links = services.links.get(test.fullTitle());
116
-
117
- client.addTestRun(STATUS.SKIPPED, {
118
- title: getTestName(test),
119
- suite_title: getSuiteTitle(test),
120
- code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
121
- file: getFile(test),
122
- test_id: testId,
123
- time: test.duration,
124
- manuallyAttachedArtifacts: artifacts,
125
- meta: keyValues,
126
- links,
87
+
88
+ runner.on(EVENT_TEST_PASS, async test => {
89
+ passes += 1;
90
+
91
+ console.log(pc.bold(pc.green('✔')), test.fullTitle());
92
+ const testId = getTestomatIdFromTestTitle(test.title);
93
+
94
+ const logs = getTestLogs(test);
95
+ const artifacts = services.artifacts.get(test.fullTitle());
96
+ const keyValues = services.keyValues.get(test.fullTitle());
97
+ const links = services.links.get(test.fullTitle());
98
+
99
+ client.addTestRun(STATUS.PASSED, {
100
+ test_id: testId,
101
+ suite_title: getSuiteTitle(test),
102
+ title: getTestName(test),
103
+ code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
104
+ file: getFile(test),
105
+ time: test.duration,
106
+ logs,
107
+ manuallyAttachedArtifacts: artifacts,
108
+ meta: keyValues,
109
+ links,
110
+ });
127
111
  });
128
- });
129
112
 
130
- runner.on(EVENT_TEST_FAIL, async (test, err) => {
131
- failures += 1;
132
- console.log(pc.bold(pc.red('✖')), test.fullTitle(), pc.gray(err.message));
113
+ runner.on(EVENT_TEST_PENDING, test => {
114
+ skipped += 1;
115
+ console.log('skip: %s', test.fullTitle());
116
+ const testId = getTestomatIdFromTestTitle(test.title);
117
+ const artifacts = services.artifacts.get(test.fullTitle());
118
+ const keyValues = services.keyValues.get(test.fullTitle());
119
+ const links = services.links.get(test.fullTitle());
120
+
121
+ client.addTestRun(STATUS.SKIPPED, {
122
+ title: getTestName(test),
123
+ suite_title: getSuiteTitle(test),
124
+ code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
125
+ file: getFile(test),
126
+ test_id: testId,
127
+ time: test.duration,
128
+ manuallyAttachedArtifacts: artifacts,
129
+ meta: keyValues,
130
+ links,
131
+ });
132
+ });
133
+
134
+ runner.on(EVENT_TEST_FAIL, async (test, err) => {
135
+ failures += 1;
136
+ console.log(pc.bold(pc.red('✖')), test.fullTitle(), pc.gray(err.message));
137
+
138
+ const isHookFailure = test.title.includes('before each') || test.title.includes('after each');
133
139
 
134
- const isHookFailure = test.title.includes('before each') || test.title.includes('after each');
140
+ if (isHookFailure && test.parent) {
141
+ hookFailures.set(test.parent.fullTitle(), {
142
+ error: err,
143
+ suiteTitle: getSuiteTitle(test),
144
+ });
145
+ return;
146
+ }
147
+
148
+ const testId = getTestomatIdFromTestTitle(test.title);
135
149
 
136
- if (isHookFailure && test.parent) {
137
- hookFailures.set(test.parent.fullTitle(), {
150
+ const logs = getTestLogs(test);
151
+ const artifacts = services.artifacts.get(test.fullTitle());
152
+ const keyValues = services.keyValues.get(test.fullTitle());
153
+ const links = services.links.get(test.fullTitle());
154
+
155
+ client.addTestRun(STATUS.FAILED, {
138
156
  error: err,
139
- suiteTitle: getSuiteTitle(test),
157
+ suite_title: getSuiteTitle(test),
158
+ file: getFile(test),
159
+ test_id: testId,
160
+ title: getTestName(test),
161
+ code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
162
+ time: test.duration,
163
+ logs,
164
+ manuallyAttachedArtifacts: artifacts,
165
+ meta: keyValues,
166
+ links,
140
167
  });
141
- return;
142
- }
143
-
144
- const testId = getTestomatIdFromTestTitle(test.title);
145
-
146
- const logs = getTestLogs(test);
147
- const artifacts = services.artifacts.get(test.fullTitle());
148
- const keyValues = services.keyValues.get(test.fullTitle());
149
- const links = services.links.get(test.fullTitle());
150
-
151
- client.addTestRun(STATUS.FAILED, {
152
- error: err,
153
- suite_title: getSuiteTitle(test),
154
- file: getFile(test),
155
- test_id: testId,
156
- title: getTestName(test),
157
- code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
158
- time: test.duration,
159
- logs,
160
- manuallyAttachedArtifacts: artifacts,
161
- meta: keyValues,
162
- links,
163
168
  });
164
- });
165
-
166
- runner.on(EVENT_RUN_END, () => {
167
- const status = failures === 0 ? STATUS.PASSED : STATUS.FAILED;
168
- console.log(pc.bold(status), `${passes} passed, ${failures} failed, ${skipped} skipped`);
169
- // @ts-ignore
170
- client.updateRunStatus(status);
171
- });
169
+
170
+ runner.on(EVENT_RUN_END, () => {
171
+ const status = failures === 0 ? STATUS.PASSED : STATUS.FAILED;
172
+ console.log(pc.bold(status), `${passes} passed, ${failures} failed, ${skipped} skipped`);
173
+ // @ts-ignore
174
+ client.updateRunStatus(status);
175
+ });
176
+ }
172
177
  }
173
178
 
174
179
  function getTestLogs(test) {
@@ -204,8 +209,4 @@ function getTestName(test) {
204
209
  return test.title;
205
210
  }
206
211
 
207
- // To have this reporter "extend" a built-in reporter uncomment the following line:
208
- // @ts-ignore
209
- Mocha.utils.inherits(MochaReporter, Mocha.reporters.Spec);
210
-
211
212
  export default MochaReporter;
@@ -3,6 +3,8 @@ import { config } from '../config.js';
3
3
  import { STATUS } from '../constants.js';
4
4
  import { getTestomatIdFromTestTitle } from '../utils/utils.js';
5
5
 
6
+ global.TESTOMATIO_ADAPTER = 'nightwatch';
7
+
6
8
  const apiKey = config.TESTOMATIO;
7
9
  const client = new TestomatClient({ apiKey });
8
10
 
@@ -14,6 +14,8 @@ import { fetchLinksFromLogs } from './utils/playwright.js';
14
14
  import { formatStep, addStatusToStep, addArtifactsToStep } from './utils/step-formatter.js';
15
15
  import { log } from '../utils/log.js';
16
16
 
17
+ global.TESTOMATIO_ADAPTER = 'playwright';
18
+
17
19
  class PlaywrightReporter {
18
20
  constructor(config = {}) {
19
21
  this.client = new TestomatioClient({ apiKey: config?.apiKey });
@@ -6,6 +6,8 @@ import createDebugMessages from 'debug';
6
6
 
7
7
  const debug = createDebugMessages('@testomatio/reporter:adapter-jest');
8
8
 
9
+ global.TESTOMATIO_ADAPTER = 'vitest';
10
+
9
11
  /**
10
12
  * @typedef {import('../../types/types.js').VitestTest} VitestTest
11
13
  * @typedef {import('../../types/types.js').VitestTestFile} VitestTestFile
@@ -5,6 +5,8 @@ import { services } from '../services/index.js';
5
5
  import { TESTOMAT_TMP_STORAGE_DIR } from '../constants.js';
6
6
  import { stringToMD5Hash } from '../data-storage.js';
7
7
 
8
+ global.TESTOMATIO_ADAPTER = 'webdriverio';
9
+
8
10
  class WebdriverReporter extends WDIOReporter {
9
11
  constructor(options) {
10
12
  super(options);
@@ -186,7 +186,8 @@ class AllureReader {
186
186
  steps: this.convertSteps(result.steps || [], resultsDir),
187
187
  message: result.statusDetails?.message || '',
188
188
  stack: result.statusDetails?.trace || '',
189
- meta: this.extractMeta(result),
189
+ // meta must always include reporter version and adapter used
190
+ meta: { ...this.extractMeta(result), reporterVersion: this.version, adapter: 'allure' },
190
191
  links: this.extractLinks(result),
191
192
  artifacts: [],
192
193
  create: true,