@testomatio/reporter 2.1.3-beta.2-xml-import → 2.1.3-beta.3-multi-links

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.
@@ -321,7 +321,7 @@ const fileSystem = {
321
321
  exports.fileSystem = fileSystem;
322
322
  const foundedTestLog = (app, tests) => {
323
323
  const n = tests.length;
324
- return console.log(app, `✅ We found ${n === 1 ? 'one test' : `${n} tests`} in Testomat.io!`);
324
+ return n === 1 ? console.log(app, `✅ We found one test!`) : console.log(app, `✅ We found ${n} tests!`);
325
325
  };
326
326
  exports.foundedTestLog = foundedTestLog;
327
327
  const humanize = text => {
@@ -399,8 +399,6 @@ function storeRunId(runId) {
399
399
  function readLatestRunId() {
400
400
  try {
401
401
  const filePath = path_1.default.join(os_1.default.tmpdir(), `testomatio.latest.run`);
402
- if (!fs_1.default.existsSync(filePath))
403
- return null;
404
402
  const stats = fs_1.default.statSync(filePath);
405
403
  const diff = +new Date() - +stats.mtime;
406
404
  const diffHours = diff / 1000 / 60 / 60;
@@ -77,13 +77,6 @@ declare class XmlReader {
77
77
  skipped_count: number;
78
78
  tests: any[];
79
79
  };
80
- deduplicateTestsByFQN(tests: any): any[];
81
- generateFQN(test: any): string;
82
- generateNormalizedFQN(test: any): string;
83
- extractAssemblyName(test: any): any;
84
- extractNamespace(test: any): any;
85
- extractClassName(test: any): any;
86
- extractCsFileFromPath(test: any): any;
87
80
  calculateStats(): {};
88
81
  fetchSourceCode(): void;
89
82
  formatTests(): void;
package/lib/xmlReader.js CHANGED
@@ -131,9 +131,7 @@ class XmlReader {
131
131
  const { result, total, passed, failed, inconclusive, skipped } = jsonSuite;
132
132
  reduceOptions.preferClassname = this.stats.language === 'python';
133
133
  const resultTests = processTestSuite(jsonSuite['test-suite']);
134
- // Deduplicate tests based on FQN (Assembly + Namespace + Class + Method)
135
- const deduplicatedTests = this.deduplicateTestsByFQN(resultTests);
136
- this.tests = this.tests.concat(deduplicatedTests);
134
+ this.tests = this.tests.concat(resultTests);
137
135
  return {
138
136
  status: result?.toLowerCase(),
139
137
  create_tests: true,
@@ -141,7 +139,7 @@ class XmlReader {
141
139
  passed_count: parseInt(passed, 10),
142
140
  failed_count: parseInt(failed, 10),
143
141
  skipped_count: parseInt(inconclusive + skipped, 10),
144
- tests: deduplicatedTests,
142
+ tests: resultTests,
145
143
  };
146
144
  }
147
145
  processTRX(jsonSuite) {
@@ -277,169 +275,6 @@ class XmlReader {
277
275
  tests,
278
276
  };
279
277
  }
280
- deduplicateTestsByFQN(tests) {
281
- const fqnMap = new Map();
282
- tests.forEach(test => {
283
- const fqn = this.generateNormalizedFQN(test);
284
- if (fqnMap.has(fqn)) {
285
- const existingTest = fqnMap.get(fqn);
286
- // For parameterized tests, merge as Examples
287
- if (test.example) {
288
- // Initialize examples array if it doesn't exist
289
- if (!existingTest.examples) {
290
- existingTest.examples = [];
291
- // Add the existing test's example as the first item
292
- if (existingTest.example) {
293
- existingTest.examples.push({
294
- parameters: existingTest.example,
295
- status: existingTest.status,
296
- run_time: existingTest.run_time,
297
- message: existingTest.message,
298
- stack: existingTest.stack
299
- });
300
- }
301
- }
302
- // Add this test's execution as an example
303
- existingTest.examples.push({
304
- parameters: test.example,
305
- status: test.status,
306
- run_time: test.run_time,
307
- message: test.message,
308
- stack: test.stack
309
- });
310
- // Update the main test status to reflect the worst status
311
- if (test.status === 'failed' || existingTest.status === 'failed') {
312
- existingTest.status = 'failed';
313
- }
314
- else if (test.status === 'skipped' && existingTest.status !== 'failed') {
315
- existingTest.status = 'skipped';
316
- }
317
- // Update total run time
318
- existingTest.run_time = (existingTest.run_time || 0) + (test.run_time || 0);
319
- // Merge stack traces if they're different
320
- if (test.stack && test.stack !== existingTest.stack) {
321
- existingTest.stack = existingTest.stack + '\n\n---\n\n' + test.stack;
322
- }
323
- // Merge messages if they're different
324
- if (test.message && test.message !== existingTest.message) {
325
- existingTest.message = existingTest.message + '; ' + test.message;
326
- }
327
- }
328
- else {
329
- // Merge test properties for non-parameterized tests, prioritizing Test Explorer structure
330
- if (test.test_id && !existingTest.test_id) {
331
- existingTest.test_id = test.test_id;
332
- }
333
- // Keep the most complete test data
334
- if (test.stack && !existingTest.stack) {
335
- existingTest.stack = test.stack;
336
- }
337
- if (test.message && !existingTest.message) {
338
- existingTest.message = test.message;
339
- }
340
- }
341
- // Prefer Test Explorer structure (longer, more complete suite_title)
342
- if (test.suite_title && test.suite_title.length > existingTest.suite_title.length) {
343
- existingTest.suite_title = test.suite_title;
344
- existingTest.file = this.extractCsFileFromPath(test);
345
- }
346
- }
347
- else {
348
- // Fix file path to use proper .cs file names from source paths
349
- test.file = this.extractCsFileFromPath(test);
350
- fqnMap.set(fqn, test);
351
- }
352
- });
353
- return Array.from(fqnMap.values());
354
- }
355
- generateFQN(test) {
356
- // Generate Fully Qualified Name: Namespace + Class + Method (standard .NET FQN)
357
- // Don't include assembly as it can vary between different test structures
358
- const namespace = this.extractNamespace(test);
359
- const className = this.extractClassName(test);
360
- const methodName = test.title;
361
- // Use the most complete namespace.class structure available
362
- if (test.suite_title && test.suite_title.includes('.')) {
363
- return `${test.suite_title}.${methodName}`;
364
- }
365
- return `${namespace}.${className}.${methodName}`;
366
- }
367
- generateNormalizedFQN(test) {
368
- // Generate normalized FQN for deduplication by extracting the core namespace.class.method
369
- // For parameterized tests, we want the SAME FQN so they merge into one test with multiple Examples
370
- const fullClassName = test.suite_title || '';
371
- const methodName = test.title;
372
- // Extract the most specific namespace.class pattern
373
- if (fullClassName.includes('.')) {
374
- const parts = fullClassName.split('.');
375
- if (parts.length >= 2) {
376
- const className = parts[parts.length - 1];
377
- // Look for common .NET namespace patterns and normalize them:
378
- // TestProject.Tests.MyClass -> Tests.MyClass
379
- // Tests.MyClass -> Tests.MyClass
380
- // MyProject.SubNamespace.Tests.MyClass -> Tests.MyClass
381
- let normalizedNamespace = '';
382
- for (let i = parts.length - 2; i >= 0; i--) {
383
- const part = parts[i];
384
- // Build namespace from right to left, excluding project names
385
- if (part === 'Tests' || part.endsWith('Tests') || part.includes('Test')) {
386
- // Found a test namespace, use it as the normalized namespace
387
- normalizedNamespace = part;
388
- break;
389
- }
390
- else if (i === parts.length - 2) {
391
- // If no test namespace found, use the immediate parent as namespace
392
- normalizedNamespace = part;
393
- }
394
- }
395
- return `${normalizedNamespace}.${className}.${methodName}`;
396
- }
397
- }
398
- // Fallback for simple class names
399
- return `${fullClassName}.${methodName}`;
400
- }
401
- extractAssemblyName(test) {
402
- // Extract assembly name from file path or use default
403
- if (test.file) {
404
- const parts = test.file.split(/[/\\]/);
405
- return parts[0] || 'DefaultAssembly';
406
- }
407
- return 'DefaultAssembly';
408
- }
409
- extractNamespace(test) {
410
- // Extract namespace from suite_title or classname
411
- if (test.suite_title && test.suite_title.includes('.')) {
412
- const parts = test.suite_title.split('.');
413
- return parts.slice(0, -1).join('.');
414
- }
415
- return test.suite_title || 'DefaultNamespace';
416
- }
417
- extractClassName(test) {
418
- // Extract class name from suite_title
419
- if (test.suite_title && test.suite_title.includes('.')) {
420
- const parts = test.suite_title.split('.');
421
- return parts[parts.length - 1];
422
- }
423
- return test.suite_title || 'DefaultClass';
424
- }
425
- extractCsFileFromPath(test) {
426
- // Extract .cs file name from source file path, not namespace
427
- if (test.file) {
428
- // Look for actual .cs file path patterns
429
- const csFileMatch = test.file.match(/([^/\\]+\.cs)$/);
430
- if (csFileMatch) {
431
- return test.file;
432
- }
433
- // If no .cs extension, assume it's a namespace path and convert to likely file name
434
- const className = this.extractClassName(test);
435
- const pathParts = test.file.split(/[/\\]/);
436
- pathParts[pathParts.length - 1] = `${className}.cs`;
437
- return pathParts.join('/');
438
- }
439
- // Fallback to class name
440
- const className = this.extractClassName(test);
441
- return `${className}.cs`;
442
- }
443
278
  calculateStats() {
444
279
  this.stats = {
445
280
  ...this.stats,
@@ -595,8 +430,7 @@ function reduceTestCases(prev, item) {
595
430
  testCases
596
431
  .filter(t => !!t)
597
432
  .forEach(testCaseItem => {
598
- // Use consistent Test Explorer structure: prioritize fullname for file path
599
- const file = extractSourceFilePath(testCaseItem, item);
433
+ const file = testCaseItem.file || item.filepath || item.fullname || item.package || '';
600
434
  let stack = '';
601
435
  let message = '';
602
436
  if (testCaseItem.error)
@@ -616,20 +450,16 @@ function reduceTestCases(prev, item) {
616
450
  if (!message)
617
451
  message = stack.trim().split('\n')[0];
618
452
  const isParametrized = item.type === 'ParameterizedMethod';
453
+ const preferClassname = reduceOptions.preferClassname || isParametrized;
619
454
  // SpecFlow config
620
455
  let { title, tags, testId } = fetchProperties(isParametrized ? item : testCaseItem);
621
456
  let example = null;
622
- // Use consistent Test Explorer structure for suite title
623
- const suiteTitle = extractTestExplorerSuiteTitle(testCaseItem, item);
457
+ const suiteTitle = preferClassname ? testCaseItem.classname : item.name || testCaseItem.classname;
624
458
  title ||= testCaseItem.name || testCaseItem.methodname || testCaseItem.classname;
625
459
  tags ||= [];
626
- // Store original test name for parameter extraction
627
- const originalTestName = testCaseItem.name || testCaseItem.methodname;
628
- const exampleMatches = originalTestName?.match(/\((.*?)\)$/);
460
+ const exampleMatches = testCaseItem.name?.match(/\S\((.*?)\)/);
629
461
  if (exampleMatches) {
630
- // Extract and store parameters as Examples
631
- const parameterValues = exampleMatches[1].split(',').map(v => v.trim().replace(/['"]/g, ''));
632
- example = { ...parameterValues };
462
+ example = { ...exampleMatches[1].split(',').map(v => v.trim().replace(/[^\w\s-]/g, '')) };
633
463
  title = title.replace(/\(.*?\)/, '').trim();
634
464
  }
635
465
  stack = `${testCaseItem['system-out'] || testCaseItem.output || testCaseItem.log || ''}\n\n${stack}\n\n${suiteOutput}\n\n${suiteErr}`.trim();
@@ -678,7 +508,6 @@ function reduceTestCases(prev, item) {
678
508
  run_time: parseFloat(testCaseItem.time || testCaseItem.duration) * 1000,
679
509
  status,
680
510
  title,
681
- originalTestName, // Store original name for parameter-aware FQN generation
682
511
  root_suite_id: TESTOMATIO_SUITE,
683
512
  suite_title: suiteTitle,
684
513
  files,
@@ -687,51 +516,6 @@ function reduceTestCases(prev, item) {
687
516
  });
688
517
  return prev;
689
518
  }
690
- function extractSourceFilePath(testCaseItem, item) {
691
- // Priority order for file path extraction to match Test Explorer structure:
692
- // 1. fullname (contains full project path)
693
- // 2. filepath (direct file path)
694
- // 3. file attribute from test case
695
- // 4. package (fallback)
696
- if (item.fullname) {
697
- // Extract actual file path from fullname if it contains path separators
698
- const fullnameParts = item.fullname.split('.');
699
- if (fullnameParts.length > 2) {
700
- // Reconstruct path from project.namespace.class structure
701
- const projectName = fullnameParts[0];
702
- const namespaceParts = fullnameParts.slice(1, -1);
703
- const className = fullnameParts[fullnameParts.length - 1];
704
- return `${projectName}/${namespaceParts.join('/')}/${className}.cs`;
705
- }
706
- }
707
- if (item.filepath)
708
- return item.filepath;
709
- if (testCaseItem.file)
710
- return testCaseItem.file;
711
- if (item.package)
712
- return item.package;
713
- // Fallback: construct from classname
714
- if (testCaseItem.classname) {
715
- const parts = testCaseItem.classname.split('.');
716
- const className = parts[parts.length - 1];
717
- const namespacePath = parts.slice(0, -1).join('/');
718
- return `${namespacePath}/${className}.cs`;
719
- }
720
- return '';
721
- }
722
- function extractTestExplorerSuiteTitle(testCaseItem, item) {
723
- // Extract suite title to match Test Explorer structure (Project/Namespace hierarchy)
724
- // Priority: fullname > classname > name
725
- if (item.fullname) {
726
- // Use fullname to maintain Test Explorer structure
727
- return item.fullname;
728
- }
729
- if (testCaseItem.classname) {
730
- return testCaseItem.classname;
731
- }
732
- // Fallback to item name but prefer classname structure
733
- return item.name || testCaseItem.classname || 'UnknownClass';
734
- }
735
519
  function processTestSuite(testsuite) {
736
520
  if (!testsuite)
737
521
  return [];
@@ -743,14 +527,8 @@ function processTestSuite(testsuite) {
743
527
  if (!Array.isArray(testsuite)) {
744
528
  suites = [testsuite];
745
529
  }
746
- // Only process suites that have test cases OR child suites, but avoid double processing
747
- const subSuites = suites.filter(s => s['test-suite'] && !s['test-case']);
748
- const leafSuites = suites.filter(s => s['test-case'] || s.testcase);
749
- // Process child suites recursively
750
- const childResults = subSuites.map(s => processTestSuite(s['test-suite'])).flat();
751
- // Process leaf suites with actual test cases
752
- const leafResults = leafSuites.reduce(reduceTestCases, []);
753
- return [...childResults, ...leafResults];
530
+ const subSuites = suites.filter(s => s['test-suite'] && !testsuite['test-case']);
531
+ return [...subSuites.map(s => processTestSuite(s['test-suite'])), ...suites.reduce(reduceTestCases, [])].flat();
754
532
  }
755
533
  function fetchProperties(item) {
756
534
  const tags = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "2.1.3-beta.2-xml-import",
3
+ "version": "2.1.3-beta.3-multi-links",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -54,6 +54,8 @@ function CodeceptReporter(config) {
54
54
  say: output.say,
55
55
  };
56
56
 
57
+ output.stepShift = 0;
58
+
57
59
  output.debug = function(msg) {
58
60
  originalOutput.debug(msg);
59
61
  dataStorage.putData('log', repeat(this?.stepShift || 0) + pc.cyan(msg.toString()));
@@ -69,7 +71,6 @@ function CodeceptReporter(config) {
69
71
  originalOutput.log(msg);
70
72
  dataStorage.putData('log', repeat(this?.stepShift || 0) + pc.gray(msg));
71
73
  };
72
- output.stepShift = 0;
73
74
 
74
75
  recorder.startUnlessRunning();
75
76
 
@@ -163,7 +164,7 @@ function CodeceptReporter(config) {
163
164
  const manuallyAttachedArtifacts = services.artifacts.get(test.fullTitle());
164
165
  const keyValues = services.keyValues.get(test.fullTitle());
165
166
  const stepHierarchy = buildUnifiedStepHierarchy(test.steps, hookSteps);
166
- const links = services.links.get(test.fullTitle());
167
+ const labels = services.labels.get(test.fullTitle());
167
168
 
168
169
  services.setContext(null);
169
170
 
@@ -178,7 +179,7 @@ function CodeceptReporter(config) {
178
179
  files,
179
180
  steps: stepHierarchy, // Array of step objects per API schema
180
181
  logs,
181
- links,
182
+ labels,
182
183
  manuallyAttachedArtifacts,
183
184
  meta: { ...keyValues, ...test.meta },
184
185
  });
@@ -61,7 +61,6 @@ function MochaReporter(runner, opts) {
61
61
  const logs = getTestLogs(test);
62
62
  const artifacts = services.artifacts.get(test.fullTitle());
63
63
  const keyValues = services.keyValues.get(test.fullTitle());
64
- const links = services.links.get(test.fullTitle());
65
64
 
66
65
  client.addTestRun(STATUS.PASSED, {
67
66
  test_id: testId,
@@ -73,7 +72,6 @@ function MochaReporter(runner, opts) {
73
72
  logs,
74
73
  manuallyAttachedArtifacts: artifacts,
75
74
  meta: keyValues,
76
- links,
77
75
  });
78
76
  });
79
77
 
@@ -81,10 +79,6 @@ function MochaReporter(runner, opts) {
81
79
  skipped += 1;
82
80
  console.log('skip: %s', test.fullTitle());
83
81
  const testId = getTestomatIdFromTestTitle(test.title);
84
- const artifacts = services.artifacts.get(test.fullTitle());
85
- const keyValues = services.keyValues.get(test.fullTitle());
86
- const links = services.links.get(test.fullTitle());
87
-
88
82
  client.addTestRun(STATUS.SKIPPED, {
89
83
  title: getTestName(test),
90
84
  suite_title: getSuiteTitle(test),
@@ -92,9 +86,6 @@ function MochaReporter(runner, opts) {
92
86
  file: getFile(test),
93
87
  test_id: testId,
94
88
  time: test.duration,
95
- manuallyAttachedArtifacts: artifacts,
96
- meta: keyValues,
97
- links,
98
89
  });
99
90
  });
100
91
 
@@ -104,9 +95,6 @@ function MochaReporter(runner, opts) {
104
95
  const testId = getTestomatIdFromTestTitle(test.title);
105
96
 
106
97
  const logs = getTestLogs(test);
107
- const artifacts = services.artifacts.get(test.fullTitle());
108
- const keyValues = services.keyValues.get(test.fullTitle());
109
- const links = services.links.get(test.fullTitle());
110
98
 
111
99
  client.addTestRun(STATUS.FAILED, {
112
100
  error: err,
@@ -117,9 +105,6 @@ function MochaReporter(runner, opts) {
117
105
  code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
118
106
  time: test.duration,
119
107
  logs,
120
- manuallyAttachedArtifacts: artifacts,
121
- meta: keyValues,
122
- links,
123
108
  });
124
109
  });
125
110
 
@@ -53,13 +53,11 @@ class WebdriverReporter extends WDIOReporter {
53
53
  test.suite = test.parent;
54
54
  const logs = getTestLogs(test.fullTitle);
55
55
  // TODO: FIX: artifacts for some reason leads to empty report on Testomat.io
56
- // ^ not reproduced anymore (Jul 2025)
57
- // but still be under investigation
58
- const artifacts = services.artifacts.get(test.fullTitle);
59
- const keyValues = services.keyValues.get(test.fullTitle);
56
+ // const artifacts = services.artifacts.get(test.fullTitle);
57
+ // const keyValues = services.keyValues.get(test.fullTitle);
60
58
  test.logs = logs;
61
- test.artifacts = artifacts;
62
- test.meta = keyValues;
59
+ // test.artifacts = artifacts;
60
+ // test.meta = keyValues;
63
61
 
64
62
  this._addTestPromises.push(this.addTest(test));
65
63
  }
@@ -1,53 +1,124 @@
1
1
  #!/usr/bin/env node
2
- import { spawn } from 'node:child_process';
3
- import { join, dirname } from 'node:path';
4
- import { getPackageVersion } from '../utils/utils.js';
2
+ import { spawn } from 'cross-spawn';
3
+ import { Command } from 'commander';
5
4
  import pc from 'picocolors';
6
-
7
- // Define __dirname - this will be replaced by build script with actual __dirname for CommonJS
8
- const __dirname = typeof globalThis.__dirname !== 'undefined' ? globalThis.__dirname : '.';
9
- const cliPath = join(__dirname, 'cli.js');
5
+ import TestomatClient from '../client.js';
6
+ import { APP_PREFIX, STATUS } from '../constants.js';
7
+ import { getPackageVersion } from '../utils/utils.js';
8
+ import { config } from '../config.js';
9
+ import dotenv from 'dotenv';
10
10
 
11
11
  const version = getPackageVersion();
12
12
  console.log(pc.cyan(pc.bold(` 🤩 Testomat.io Reporter v${version}`)));
13
+ const program = new Command();
14
+
15
+ program
16
+ .option('-c, --command <cmd>', 'Test runner command')
17
+ .option('--launch', 'Start a new run and return its ID')
18
+ .option('--finish', 'Finish Run by its ID')
19
+ .option('--env-file <envfile>', 'Load environment variables from env file')
20
+ .option('--filter <filter>', 'Additional execution filter')
21
+ .action(async opts => {
22
+ const { launch, finish, filter } = opts;
23
+ let { command } = opts;
13
24
 
14
- // Parse command line arguments to map start-test-run options to @testomatio/reporter run format
15
- const args = process.argv.slice(2);
16
- const newArgs = ['run'];
17
-
18
- let i = 0;
19
- while (i < args.length) {
20
- const arg = args[i];
21
-
22
- if (arg === '-c' || arg === '--command') {
23
- // Map -c/--command to positional argument for run command
24
- i++;
25
- if (i < args.length) {
26
- newArgs.push(args[i]);
25
+ if (opts.envFile) dotenv.config({ path: opts.envFile });
26
+
27
+ const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || config.TESTOMATIO;
28
+ const title = process.env.TESTOMATIO_TITLE;
29
+
30
+ if (launch) {
31
+ console.log('Starting a new Run on Testomat.io...');
32
+ const client = new TestomatClient({ apiKey });
33
+
34
+ client.createRun().then(() => {
35
+ console.log(process.env.runId);
36
+ process.exit(0);
37
+ });
38
+ return;
39
+ }
40
+
41
+ if (finish) {
42
+ // TODO: add error in case of TESTOMATIO environment variable is not set
43
+ // because command is fine in console, but actually (on testomat.io) run is not finished
44
+ if (!process.env.TESTOMATIO_RUN) {
45
+ console.log('TESTOMATIO_RUN environment variable must be set.');
46
+ return process.exit(1);
47
+ }
48
+
49
+ console.log('Finishing Run on Testomat.io...');
50
+
51
+ const client = new TestomatClient({ apiKey });
52
+
53
+ // @ts-ignore
54
+ client.updateRunStatus(STATUS.FINISHED).then(() => {
55
+ console.log(pc.yellow(`Run ${process.env.TESTOMATIO_RUN} was finished`));
56
+ process.exit(0);
57
+ });
58
+ return;
59
+ }
60
+
61
+ let exitCode = 0;
62
+
63
+ if (!command.split) {
64
+ process.exitCode = 255;
65
+ console.log(APP_PREFIX, `No command provided. Use -c option to launch a test runner.`);
66
+ return;
27
67
  }
28
- } else if (arg.startsWith('--command=')) {
29
- // Handle --command=value format
30
- const command = arg.split('=', 2)[1];
31
- newArgs.push(command);
32
- } else if (arg === '--launch') {
33
- // Map --launch to start command
34
- newArgs[0] = 'start';
35
- } else if (arg === '--finish') {
36
- // Map --finish to finish command
37
- newArgs[0] = 'finish';
38
- } else {
39
- // Pass through other arguments
40
- newArgs.push(arg);
41
- }
42
- i++;
43
- }
44
68
 
45
- // Execute the main CLI with mapped arguments
69
+ const client = new TestomatClient({ apiKey, title, parallel: true });
46
70
 
47
- const child = spawn(process.execPath, [cliPath, ...newArgs], {
48
- stdio: 'inherit'
49
- });
71
+ if (filter) {
72
+ const [pipe, ...optsArray] = filter.split(':');
73
+ const pipeOptions = optsArray.join(':');
74
+
75
+ try {
76
+ const tests = await client.prepareRun({ pipe, pipeOptions });
77
+
78
+ if (!tests || tests.length === 0) {
79
+ return;
80
+ }
81
+
82
+ const grep = ` --grep (${tests.join('|')})`;
83
+ command += grep;
84
+ } catch (err) {
85
+ console.log(APP_PREFIX, err);
86
+ }
87
+ }
88
+
89
+ const testCmds = command.split(' ');
90
+ console.log(APP_PREFIX, `🚀 Running`, pc.green(command));
91
+
92
+ if (!apiKey) {
93
+ const cmd = spawn(testCmds[0], testCmds.slice(1), { stdio: 'inherit' });
94
+
95
+ cmd.on('close', code => {
96
+ console.log(APP_PREFIX, '⚠️ ', `Runner exited with ${pc.bold(code)}, report is ignored`);
97
+
98
+ if (code > exitCode) exitCode = code;
99
+ process.exitCode = exitCode;
100
+ });
101
+
102
+ return;
103
+ }
104
+
105
+ client.createRun().then(() => {
106
+ const cmd = spawn(testCmds[0], testCmds.slice(1), { stdio: 'inherit' });
107
+
108
+ cmd.on('close', code => {
109
+ const emoji = code === 0 ? '🟢' : '🔴';
110
+ console.log(APP_PREFIX, emoji, `Runner exited with ${pc.bold(code)}`);
111
+ const status = code === 0 ? 'passed' : 'failed';
112
+ client.updateRunStatus(status, true);
113
+
114
+ if (code > exitCode) exitCode = code;
115
+ process.exitCode = exitCode;
116
+ });
117
+ });
118
+ });
119
+
120
+ if (process.argv.length <= 2) {
121
+ program.outputHelp();
122
+ }
50
123
 
51
- child.on('exit', (code) => {
52
- process.exit(code);
53
- });
124
+ program.parse(process.argv);
package/src/client.js CHANGED
@@ -11,7 +11,6 @@ import path, { sep } from 'path';
11
11
  import { fileURLToPath } from 'node:url';
12
12
  import { S3Uploader } from './uploader.js';
13
13
  import { formatStep, readLatestRunId, storeRunId, validateSuiteId } from './utils/utils.js';
14
- import { linkStorage } from './services/links.js';
15
14
  import { filesize as prettyBytes } from 'filesize';
16
15
 
17
16
  const debug = createDebugMessages('@testomatio/reporter:client');
@@ -183,6 +182,7 @@ class Client {
183
182
  test_id,
184
183
  timestamp,
185
184
  manuallyAttachedArtifacts,
185
+ labels,
186
186
  overwrite,
187
187
  } = testData;
188
188
  let { message = '', meta = {} } = testData;
@@ -224,9 +224,7 @@ class Client {
224
224
  return acc;
225
225
  }, {});
226
226
 
227
- // Get links from storage using the test context
228
- const testContext = suite_title ? `${suite_title} ${title}` : title;
229
- const links = linkStorage.get(testContext) || [];
227
+ // Labels are simple array of strings, no processing needed
230
228
 
231
229
  let errorFormatted = '';
232
230
  if (error) {
@@ -282,7 +280,7 @@ class Client {
282
280
  timestamp,
283
281
  artifacts,
284
282
  meta,
285
- links,
283
+ labels,
286
284
  overwrite,
287
285
  ...(rootSuiteId && { root_suite_id: rootSuiteId }),
288
286
  };