@testomatio/reporter 2.3.1 → 2.3.2

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.
@@ -11,4 +11,10 @@ declare class PlaywrightReporter {
11
11
  onEnd(result: any): Promise<void>;
12
12
  #private;
13
13
  }
14
+ /**
15
+ * Extracts and normalizes tags from test title, test options, and suite level
16
+ * @param {*} test - testInfo object from Playwright
17
+ * @returns {string[]} - array of normalized tags
18
+ */
19
+ export function extractTags(test: any): string[];
14
20
  import TestomatioClient from '../client.js';
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.extractTags = extractTags;
6
7
  const picocolors_1 = __importDefault(require("picocolors"));
7
8
  const crypto_1 = __importDefault(require("crypto"));
8
9
  const os_1 = __importDefault(require("os"));
@@ -253,3 +254,5 @@ function getTestContextName(test) {
253
254
  return `${test._requireFile || ''}_${test.title}`;
254
255
  }
255
256
  module.exports = PlaywrightReporter;
257
+
258
+ module.exports.extractTags = extractTags;
@@ -2,7 +2,7 @@ export function getPackageVersion(): any;
2
2
  export const TEST_ID_REGEX: RegExp;
3
3
  export const SUITE_ID_REGEX: RegExp;
4
4
  export function ansiRegExp(): RegExp;
5
- export function cleanLatestRunId(): void;
5
+ export function cleanLatestRunId(): any;
6
6
  export function isSameTest(test: any, t: any): boolean;
7
7
  export function fetchSourceCode(contents: any, opts?: {}): string;
8
8
  export function fetchSourceCodeFromStackTrace(stack?: string): string;
@@ -47,7 +47,7 @@ export function removeColorCodes(input: any): any;
47
47
  * @returns {String|null} testInfo as one string
48
48
  */
49
49
  export function specificTestInfo(test: any): string | null;
50
- export function storeRunId(runId: any): void;
50
+ export function storeRunId(runId: any): any;
51
51
  export namespace testRunnerHelper {
52
52
  function getNameOfCurrentlyRunningTest(): any;
53
53
  }
@@ -390,7 +390,14 @@ function storeRunId(runId) {
390
390
  if (!runId || runId === 'undefined')
391
391
  return;
392
392
  const filePath = path_1.default.join(os_1.default.tmpdir(), `testomatio.latest.run`);
393
- fs_1.default.writeFileSync(filePath, runId);
393
+ try {
394
+ fs_1.default.writeFileSync(filePath, runId);
395
+ }
396
+ catch (e) {
397
+ if (e.code === 'ENOENT')
398
+ return null;
399
+ debug('Could not store latest run ID file: ', e.message);
400
+ }
394
401
  }
395
402
  /**
396
403
  *
@@ -409,7 +416,6 @@ function readLatestRunId() {
409
416
  return fs_1.default.readFileSync(filePath)?.toString()?.trim() ?? null;
410
417
  }
411
418
  catch (e) {
412
- debug('Could not read latest run ID from file: ', e);
413
419
  return null;
414
420
  }
415
421
  }
@@ -423,6 +429,8 @@ function cleanLatestRunId() {
423
429
  debug(`Cleaned latest run ID (${runId}) file`, filePath);
424
430
  }
425
431
  catch (e) {
432
+ if (e.code === 'ENOENT')
433
+ return null;
426
434
  console.warn('Could not clean latest run ID file: ', e);
427
435
  }
428
436
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -54,7 +54,7 @@
54
54
  "lint": "eslint src",
55
55
  "lint:fix": "eslint src --fix",
56
56
  "format": "npm run lint:fix && npm run pretty:fix",
57
- "test": "mocha tests/unit/**/*_test.js",
57
+ "test": "mocha 'tests/unit/**/*_test.js'",
58
58
  "test:playwright": "mocha tests/adapter/playwright.test.js",
59
59
  "test:codecept": "mocha tests/adapter/codecept.test.js tests/adapter/codecept_comprehensive.test.js tests/adapter/codecept_steps_sections.test.js",
60
60
  "test:frameworks": "npm run test:playwright && npm run test:codecept",
@@ -283,3 +283,4 @@ function getTestContextName(test) {
283
283
  }
284
284
 
285
285
  export default PlaywrightReporter;
286
+ export { extractTags };
@@ -350,7 +350,12 @@ const testRunnerHelper = {
350
350
  function storeRunId(runId) {
351
351
  if (!runId || runId === 'undefined') return;
352
352
  const filePath = path.join(os.tmpdir(), `testomatio.latest.run`);
353
- fs.writeFileSync(filePath, runId);
353
+ try {
354
+ fs.writeFileSync(filePath, runId);
355
+ } catch (e) {
356
+ if (e.code === 'ENOENT') return null;
357
+ debug('Could not store latest run ID file: ', e.message);
358
+ }
354
359
  }
355
360
 
356
361
  /**
@@ -369,7 +374,6 @@ function readLatestRunId() {
369
374
 
370
375
  return fs.readFileSync(filePath)?.toString()?.trim() ?? null;
371
376
  } catch (e) {
372
- debug('Could not read latest run ID from file: ', e);
373
377
  return null;
374
378
  }
375
379
  }
@@ -383,6 +387,7 @@ function cleanLatestRunId() {
383
387
  }
384
388
  debug(`Cleaned latest run ID (${runId}) file`, filePath);
385
389
  } catch (e) {
390
+ if (e.code === 'ENOENT') return null;
386
391
  console.warn('Could not clean latest run ID file: ', e);
387
392
  }
388
393
  }