@testomatio/reporter 1.6.0-beta-2-artifacts → 2.0.0-beta-esm

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 (97) hide show
  1. package/lib/adapter/codecept.js +288 -330
  2. package/lib/adapter/cucumber/current.js +195 -203
  3. package/lib/adapter/cucumber/legacy.js +130 -155
  4. package/lib/adapter/cucumber.js +5 -16
  5. package/lib/adapter/cypress-plugin/index.js +91 -105
  6. package/lib/adapter/jasmine/jasmine.js +63 -0
  7. package/lib/adapter/jasmine.js +54 -53
  8. package/lib/adapter/jest.js +97 -99
  9. package/lib/adapter/mocha/mocha.js +125 -0
  10. package/lib/adapter/mocha.js +111 -140
  11. package/lib/adapter/playwright.js +168 -200
  12. package/lib/adapter/vitest.js +144 -143
  13. package/lib/adapter/webdriver.js +113 -97
  14. package/lib/bin/reportXml.js +49 -49
  15. package/lib/bin/startTest.js +80 -97
  16. package/lib/client.js +344 -385
  17. package/lib/config.js +16 -21
  18. package/lib/constants.js +49 -43
  19. package/lib/data-storage.js +206 -188
  20. package/lib/fileUploader.js +245 -0
  21. package/lib/junit-adapter/adapter.js +17 -20
  22. package/lib/junit-adapter/csharp.js +18 -14
  23. package/lib/junit-adapter/index.js +27 -25
  24. package/lib/junit-adapter/java.js +41 -53
  25. package/lib/junit-adapter/javascript.js +30 -27
  26. package/lib/junit-adapter/python.js +38 -37
  27. package/lib/junit-adapter/ruby.js +11 -8
  28. package/lib/output.js +44 -52
  29. package/lib/package.json +1 -0
  30. package/lib/pipe/bitbucket.js +208 -227
  31. package/lib/pipe/csv.js +111 -124
  32. package/lib/pipe/github.js +184 -211
  33. package/lib/pipe/gitlab.js +164 -205
  34. package/lib/pipe/html.js +253 -312
  35. package/lib/pipe/index.js +83 -63
  36. package/lib/pipe/testomatio.js +391 -454
  37. package/lib/reporter-functions.js +16 -20
  38. package/lib/reporter.js +47 -17
  39. package/lib/services/artifacts.js +55 -51
  40. package/lib/services/index.js +14 -12
  41. package/lib/services/key-values.js +56 -53
  42. package/lib/services/logger.js +227 -245
  43. package/lib/utils/chalk.js +10 -0
  44. package/lib/utils/pipe_utils.js +91 -84
  45. package/lib/utils/utils.js +289 -273
  46. package/lib/xmlReader.js +480 -519
  47. package/package.json +57 -19
  48. package/src/adapter/codecept.js +369 -0
  49. package/src/adapter/cucumber/current.js +228 -0
  50. package/src/adapter/cucumber/legacy.js +158 -0
  51. package/src/adapter/cucumber.js +4 -0
  52. package/src/adapter/cypress-plugin/index.js +110 -0
  53. package/src/adapter/jasmine.js +60 -0
  54. package/src/adapter/jest.js +107 -0
  55. package/src/adapter/mocha.cjs +2 -0
  56. package/src/adapter/mocha.js +156 -0
  57. package/src/adapter/playwright.js +222 -0
  58. package/src/adapter/vitest.js +183 -0
  59. package/src/adapter/webdriver.js +111 -0
  60. package/src/bin/reportXml.js +67 -0
  61. package/src/bin/startTest.js +119 -0
  62. package/src/client.js +423 -0
  63. package/src/config.js +30 -0
  64. package/src/constants.js +49 -0
  65. package/src/data-storage.js +204 -0
  66. package/src/fileUploader.js +307 -0
  67. package/src/junit-adapter/adapter.js +23 -0
  68. package/src/junit-adapter/csharp.js +16 -0
  69. package/src/junit-adapter/index.js +28 -0
  70. package/src/junit-adapter/java.js +58 -0
  71. package/src/junit-adapter/javascript.js +31 -0
  72. package/src/junit-adapter/python.js +42 -0
  73. package/src/junit-adapter/ruby.js +10 -0
  74. package/src/output.js +57 -0
  75. package/src/pipe/bitbucket.js +254 -0
  76. package/src/pipe/csv.js +140 -0
  77. package/src/pipe/github.js +234 -0
  78. package/src/pipe/gitlab.js +229 -0
  79. package/src/pipe/html.js +366 -0
  80. package/src/pipe/index.js +73 -0
  81. package/src/pipe/testomatio.js +498 -0
  82. package/src/reporter-functions.js +44 -0
  83. package/src/reporter.cjs +22 -0
  84. package/src/reporter.js +24 -0
  85. package/src/services/artifacts.js +59 -0
  86. package/src/services/index.js +13 -0
  87. package/src/services/key-values.js +59 -0
  88. package/src/services/logger.js +314 -0
  89. package/src/template/emptyData.svg +23 -0
  90. package/src/template/testomatio.hbs +1421 -0
  91. package/src/utils/chalk.js +13 -0
  92. package/src/utils/pipe_utils.js +127 -0
  93. package/src/utils/utils.js +341 -0
  94. package/src/xmlReader.js +551 -0
  95. package/lib/bin/cli.js +0 -216
  96. package/lib/bin/uploadArtifacts.js +0 -86
  97. package/lib/uploader.js +0 -312
@@ -1,58 +1,59 @@
1
- const TestomatClient = require('../client');
2
- const { getTestomatIdFromTestTitle, ansiRegExp } = require('../utils/utils');
3
- const { STATUS } = require('../constants');
4
-
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.JasmineReporter = void 0;
7
+ const client_js_1 = __importDefault(require("../client.js"));
8
+ const utils_js_1 = require("../utils/utils.js");
9
+ const constants_js_1 = require("../constants.js");
5
10
  class JasmineReporter {
6
- constructor(options) {
7
- this.testTimeMap = {};
8
- this.client = new TestomatClient({ apiKey: options?.apiKey });
9
- this.client.createRun();
10
- }
11
-
12
- getDuration(test) {
13
- if (this.testTimeMap[test.id]) {
14
- return Date.now() - this.testTimeMap[test.id];
11
+ constructor(options) {
12
+ this.testTimeMap = {};
13
+ this.client = new client_js_1.default({ apiKey: options?.apiKey });
14
+ this.client.createRun();
15
15
  }
16
-
17
- return 0;
18
- }
19
-
20
- specStarted(result) {
21
- this.testTimeMap[result.id] = Date.now();
22
- }
23
-
24
- specDone(result) {
25
- if (!this.client) return;
26
-
27
- const title = result.description;
28
- const { status } = result;
29
- let errorMessage = '';
30
-
31
- for (let i = 0; i < result.failedExpectations.length; i += 1) {
32
- errorMessage = `${errorMessage}Failure: ${result.failedExpectations[i].message}\n`;
33
- errorMessage = `${errorMessage}\n ${result.failedExpectations[i].stack}`;
16
+ getDuration(test) {
17
+ if (this.testTimeMap[test.id]) {
18
+ return Date.now() - this.testTimeMap[test.id];
19
+ }
20
+ return 0;
21
+ }
22
+ specStarted(result) {
23
+ this.testTimeMap[result.id] = Date.now();
24
+ }
25
+ specDone(result) {
26
+ if (!this.client)
27
+ return;
28
+ const title = result.description;
29
+ const { status } = result;
30
+ let errorMessage = '';
31
+ for (let i = 0; i < result.failedExpectations.length; i += 1) {
32
+ errorMessage = `${errorMessage}Failure: ${result.failedExpectations[i].message}\n`;
33
+ errorMessage = `${errorMessage}\n ${result.failedExpectations[i].stack}`;
34
+ }
35
+ console.log(`${title} : ${constants_js_1.STATUS.PASSED}`);
36
+ console.log(errorMessage);
37
+ const testId = (0, utils_js_1.getTestomatIdFromTestTitle)(title);
38
+ errorMessage = errorMessage.replace((0, utils_js_1.ansiRegExp)(), '');
39
+ this.client.addTestRun(status, {
40
+ error: result.failedExpectations[0],
41
+ message: errorMessage,
42
+ test_id: testId,
43
+ title,
44
+ time: this.getDuration(result),
45
+ });
46
+ }
47
+ jasmineDone(suiteInfo, done) {
48
+ if (!this.client)
49
+ return;
50
+ const { overallStatus } = suiteInfo;
51
+ const status = overallStatus === 'failed' ? constants_js_1.STATUS.FAILED : constants_js_1.STATUS.PASSED;
52
+ // @ts-ignore
53
+ this.client.updateRunStatus(status).then(() => done);
34
54
  }
35
- console.log(`${title} : ${STATUS.PASSED}`);
36
- console.log(errorMessage);
37
- const testId = getTestomatIdFromTestTitle(title);
38
- errorMessage = errorMessage.replace(ansiRegExp(), '');
39
- this.client.addTestRun(status, {
40
- error: result.failedExpectations[0],
41
- message: errorMessage,
42
- test_id: testId,
43
- title,
44
- time: this.getDuration(result),
45
- });
46
- }
47
-
48
- jasmineDone(suiteInfo, done) {
49
- if (!this.client) return;
50
-
51
- const { overallStatus } = suiteInfo;
52
- const status = overallStatus === 'failed' ? STATUS.FAILED : STATUS.PASSED;
53
-
54
- this.client.updateRunStatus(status).then(() => done);
55
- }
56
55
  }
57
-
56
+ exports.JasmineReporter = JasmineReporter;
58
57
  module.exports = JasmineReporter;
58
+
59
+ module.exports.JasmineReporter = JasmineReporter;
@@ -1,105 +1,103 @@
1
- const chalk = require('chalk');
2
- const TestomatClient = require('../client');
3
- const { STATUS, TESTOMAT_TMP_STORAGE_DIR } = require('../constants');
4
- const { getTestomatIdFromTestTitle, ansiRegExp, fileSystem } = require('../utils/utils');
5
- const { services } = require('../services');
6
- const debug = require('debug')('@testomatio/reporter:adapter-jest');
7
- const path = require('path');
8
-
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.JestReporter = void 0;
7
+ const picocolors_1 = __importDefault(require("picocolors"));
8
+ const client_js_1 = __importDefault(require("../client.js"));
9
+ const constants_js_1 = require("../constants.js");
10
+ const utils_js_1 = require("../utils/utils.js");
11
+ const index_js_1 = require("../services/index.js");
12
+ const path_1 = __importDefault(require("path"));
13
+ const debug_1 = __importDefault(require("debug"));
14
+ const debug = (0, debug_1.default)('@testomatio/reporter:adapter-jest');
9
15
  class JestReporter {
10
- constructor(globalConfig, options) {
11
- this._globalConfig = globalConfig;
12
- this._options = options;
13
-
14
- this.client = new TestomatClient({ apiKey: options?.apiKey });
15
- this.client.createRun();
16
- }
17
-
18
- onRunStart() {
19
- // clear tmp dir
20
- fileSystem.clearDir(TESTOMAT_TMP_STORAGE_DIR);
21
- }
22
-
23
- // start of test file (including beforeAll)
24
- onTestStart(testFile) {
25
- debug('Start running test file:', testFile.path);
26
- services.setContext(testFile.path);
27
- }
28
-
29
- // start of the test (including beforeEach)
30
- onTestCaseStart(test, testCase) {
31
- debug('Start running test:', testCase.fullName);
32
- services.setContext(testCase.fullName);
33
- }
34
-
35
- // end of test file! (there is also onTestCaseResult listener)
36
- onTestResult(test, testResult) {
37
- if (!this.client) return;
38
-
39
- const { testResults } = testResult;
40
- for (const result of testResults) {
41
- let error;
42
- let steps;
43
- const { status, title, duration, failureMessages } = result;
44
- if (failureMessages[0]) {
45
- let errorMessage = failureMessages[0].replace(ansiRegExp(), '');
46
- errorMessage = errorMessage.split('\n')[0];
47
- error = new Error(errorMessage);
48
- steps = failureMessages[0];
49
- }
50
- const testId = getTestomatIdFromTestTitle(title);
51
-
52
- // suite titles from most outer to most inner, separated by space
53
- let fullSuiteTitle = testResult.ancestorTitles?.join(' ');
54
- // if no suite titles, use file name
55
- if (!fullSuiteTitle && testResult.testFilePath) fullSuiteTitle = path.basename(testResult.testFilePath);
56
-
57
- const logs = getTestLogs(result);
58
- const artifacts = services.artifacts.get(result.fullName);
59
- const keyValues = services.keyValues.get(result.fullName);
60
-
61
- const deducedStatus = status === 'pending' ? 'skipped' : status;
62
- // In jest if test is not matched with test name pattern it is considered as skipped.
63
- // So adding a check if it is skipped for real or because of test pattern
64
- if (!this._globalConfig.testNamePattern || deducedStatus !== 'skipped') {
65
- this.client.addTestRun(deducedStatus, {
66
- test_id: testId,
67
- suite_title: fullSuiteTitle,
68
- error,
69
- steps,
70
- title,
71
- time: duration,
72
- logs,
73
- manuallyAttachedArtifacts: artifacts,
74
- meta: keyValues,
75
- });
76
- }
16
+ constructor(globalConfig, options) {
17
+ this._globalConfig = globalConfig;
18
+ this._options = options;
19
+ this.client = new client_js_1.default({ apiKey: options?.apiKey });
20
+ this.client.createRun();
21
+ }
22
+ onRunStart() {
23
+ // clear tmp dir
24
+ utils_js_1.fileSystem.clearDir(constants_js_1.TESTOMAT_TMP_STORAGE_DIR);
25
+ }
26
+ // start of test file (including beforeAll)
27
+ onTestStart(testFile) {
28
+ debug('Start running test file:', testFile.path);
29
+ index_js_1.services.setContext(testFile.path);
30
+ }
31
+ // start of the test (including beforeEach)
32
+ onTestCaseStart(test, testCase) {
33
+ debug('Start running test:', testCase.fullName);
34
+ index_js_1.services.setContext(testCase.fullName);
35
+ }
36
+ // end of test file! (there is also onTestCaseResult listener)
37
+ onTestResult(test, testResult) {
38
+ if (!this.client)
39
+ return;
40
+ const { testResults } = testResult;
41
+ for (const result of testResults) {
42
+ let error;
43
+ let steps;
44
+ const { status, title, duration, failureMessages } = result;
45
+ if (failureMessages[0]) {
46
+ let errorMessage = failureMessages[0].replace((0, utils_js_1.ansiRegExp)(), '');
47
+ errorMessage = errorMessage.split('\n')[0];
48
+ error = new Error(errorMessage);
49
+ steps = failureMessages[0];
50
+ }
51
+ const testId = (0, utils_js_1.getTestomatIdFromTestTitle)(title);
52
+ // suite titles from most outer to most inner, separated by space
53
+ let fullSuiteTitle = testResult.ancestorTitles?.join(' ');
54
+ // if no suite titles, use file name
55
+ if (!fullSuiteTitle && testResult.testFilePath)
56
+ fullSuiteTitle = path_1.default.basename(testResult.testFilePath);
57
+ const logs = getTestLogs(result);
58
+ const artifacts = index_js_1.services.artifacts.get(result.fullName);
59
+ const keyValues = index_js_1.services.keyValues.get(result.fullName);
60
+ const deducedStatus = status === 'pending' ? 'skipped' : status;
61
+ // In jest if test is not matched with test name pattern it is considered as skipped.
62
+ // So adding a check if it is skipped for real or because of test pattern
63
+ if (!this._globalConfig.testNamePattern || deducedStatus !== 'skipped') {
64
+ this.client.addTestRun(deducedStatus, {
65
+ test_id: testId,
66
+ suite_title: fullSuiteTitle,
67
+ error,
68
+ steps,
69
+ title,
70
+ time: duration,
71
+ logs,
72
+ manuallyAttachedArtifacts: artifacts,
73
+ meta: keyValues,
74
+ });
75
+ }
76
+ }
77
+ }
78
+ onRunComplete(contexts, results) {
79
+ if (!this.client)
80
+ return;
81
+ const { numFailedTests } = results;
82
+ const status = numFailedTests === 0 ? 'passed' : 'failed';
83
+ this.client.updateRunStatus(status);
77
84
  }
78
- }
79
-
80
- onRunComplete(contexts, results) {
81
- if (!this.client) return;
82
-
83
- const { numFailedTests } = results;
84
- const status = numFailedTests === 0 ? STATUS.PASSED : STATUS.FAILED;
85
- this.client.updateRunStatus(status);
86
- }
87
85
  }
88
-
86
+ exports.JestReporter = JestReporter;
89
87
  function getTestLogs(testResult) {
90
- const suiteLogsArr = services.logger.getLogs(testResult.testFilePath);
91
- const suiteLogs = suiteLogsArr ? suiteLogsArr.join('\n').trim() : '';
92
- const testLogsArr = services.logger.getLogs(testResult.fullName);
93
- const testLogs = testLogsArr ? testLogsArr.join('\n').trim() : '';
94
-
95
- let logs = '';
96
- if (suiteLogs) {
97
- logs += `${chalk.bold('\t--- Suite ---')}\n${suiteLogs}`;
98
- }
99
- if (testLogs) {
100
- logs += `\n${chalk.bold('\t--- Test ---')}\n${testLogs}`;
101
- }
102
- return logs;
88
+ const suiteLogsArr = index_js_1.services.logger.getLogs(testResult.testFilePath);
89
+ const suiteLogs = suiteLogsArr ? suiteLogsArr.join('\n').trim() : '';
90
+ const testLogsArr = index_js_1.services.logger.getLogs(testResult.fullName);
91
+ const testLogs = testLogsArr ? testLogsArr.join('\n').trim() : '';
92
+ let logs = '';
93
+ if (suiteLogs) {
94
+ logs += `${picocolors_1.default.bold('\t--- Suite ---')}\n${suiteLogs}`;
95
+ }
96
+ if (testLogs) {
97
+ logs += `\n${picocolors_1.default.bold('\t--- Test ---')}\n${testLogs}`;
98
+ }
99
+ return logs;
103
100
  }
104
-
105
101
  module.exports = JestReporter;
102
+
103
+ module.exports.JestReporter = JestReporter;
@@ -0,0 +1,125 @@
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
+ // eslint-disable-next-line global-require, import/no-extraneous-dependencies
7
+ const mocha_1 = __importDefault(require("mocha"));
8
+ const client_js_1 = __importDefault(require("../../client.js"));
9
+ const constants_js_1 = require("../../constants.js");
10
+ const utils_js_1 = require("../../utils/utils.js");
11
+ const config_js_1 = require("../../config.js");
12
+ const index_js_1 = require("../../services/index.js");
13
+ const picocolors_1 = __importDefault(require("picocolors"));
14
+ const { EVENT_RUN_BEGIN, EVENT_RUN_END, EVENT_TEST_FAIL, EVENT_TEST_PASS, EVENT_TEST_PENDING, EVENT_SUITE_BEGIN, EVENT_SUITE_END, EVENT_TEST_BEGIN, EVENT_TEST_END, } = mocha_1.default.Runner.constants;
15
+ function MochaReporter(runner, opts) {
16
+ mocha_1.default.reporters.Base.call(this, runner);
17
+ let passes = 0;
18
+ let failures = 0;
19
+ let skipped = 0;
20
+ // let artifactStore;
21
+ const apiKey = opts?.reporterOptions?.apiKey || config_js_1.config.TESTOMATIO;
22
+ const client = new client_js_1.default({ apiKey });
23
+ runner.on(EVENT_RUN_BEGIN, () => {
24
+ client.createRun();
25
+ utils_js_1.fileSystem.clearDir(constants_js_1.TESTOMAT_TMP_STORAGE_DIR);
26
+ });
27
+ runner.on(EVENT_SUITE_BEGIN, async (suite) => {
28
+ index_js_1.services.setContext(suite.fullTitle());
29
+ });
30
+ runner.on(EVENT_SUITE_END, async () => {
31
+ index_js_1.services.setContext(null);
32
+ });
33
+ runner.on(EVENT_TEST_BEGIN, async (test) => {
34
+ index_js_1.services.setContext(test.fullTitle());
35
+ });
36
+ runner.on(EVENT_TEST_END, async () => {
37
+ index_js_1.services.setContext(null);
38
+ });
39
+ runner.on(EVENT_TEST_PASS, async (test) => {
40
+ passes += 1;
41
+ console.log(picocolors_1.default.bold(picocolors_1.default.green('✔')), test.fullTitle());
42
+ const testId = (0, utils_js_1.getTestomatIdFromTestTitle)(test.title);
43
+ const logs = getTestLogs(test);
44
+ const artifacts = index_js_1.services.artifacts.get(test.fullTitle());
45
+ const keyValues = index_js_1.services.keyValues.get(test.fullTitle());
46
+ client.addTestRun(constants_js_1.STATUS.PASSED, {
47
+ test_id: testId,
48
+ suite_title: getSuiteTitle(test),
49
+ title: getTestName(test),
50
+ code: test.body.toString(),
51
+ file: getFile(test),
52
+ time: test.duration,
53
+ logs,
54
+ manuallyAttachedArtifacts: artifacts,
55
+ meta: keyValues,
56
+ });
57
+ });
58
+ runner.on(EVENT_TEST_PENDING, test => {
59
+ skipped += 1;
60
+ console.log('skip: %s', test.fullTitle());
61
+ const testId = (0, utils_js_1.getTestomatIdFromTestTitle)(test.title);
62
+ client.addTestRun(constants_js_1.STATUS.SKIPPED, {
63
+ title: getTestName(test),
64
+ suite_title: getSuiteTitle(test),
65
+ code: test.body.toString(),
66
+ file: getFile(test),
67
+ test_id: testId,
68
+ time: test.duration,
69
+ });
70
+ });
71
+ runner.on(EVENT_TEST_FAIL, async (test, err) => {
72
+ failures += 1;
73
+ console.log(picocolors_1.default.bold(picocolors_1.default.red('✖')), test.fullTitle(), picocolors_1.default.gray(err.message));
74
+ const testId = (0, utils_js_1.getTestomatIdFromTestTitle)(test.title);
75
+ const logs = getTestLogs(test);
76
+ client.addTestRun(constants_js_1.STATUS.FAILED, {
77
+ error: err,
78
+ suite_title: getSuiteTitle(test),
79
+ file: getFile(test),
80
+ test_id: testId,
81
+ title: getTestName(test),
82
+ code: test.body.toString(),
83
+ time: test.duration,
84
+ logs,
85
+ });
86
+ });
87
+ runner.on(EVENT_RUN_END, () => {
88
+ const status = failures === 0 ? constants_js_1.STATUS.PASSED : constants_js_1.STATUS.FAILED;
89
+ console.log(picocolors_1.default.bold(status), `${passes} passed, ${failures} failed, ${skipped} skipped`);
90
+ // @ts-ignore
91
+ client.updateRunStatus(status);
92
+ });
93
+ }
94
+ function getTestLogs(test) {
95
+ const suiteLogsArr = index_js_1.services.logger.getLogs(test.parent.fullTitle());
96
+ const suiteLogs = suiteLogsArr ? suiteLogsArr.join('\n').trim() : '';
97
+ const testLogsArr = index_js_1.services.logger.getLogs(test.fullTitle());
98
+ const testLogs = testLogsArr ? testLogsArr.join('\n').trim() : '';
99
+ let logs = '';
100
+ if (suiteLogs) {
101
+ logs += `${picocolors_1.default.bold('\t--- BeforeSuite ---')}\n${suiteLogs}`;
102
+ }
103
+ if (testLogs) {
104
+ logs += `\n${picocolors_1.default.bold('\t--- Test ---')}\n${testLogs}`;
105
+ }
106
+ return logs;
107
+ }
108
+ function getSuiteTitle(test, pathArr = []) {
109
+ if (test.parent.parent)
110
+ getSuiteTitle(test.parent, pathArr);
111
+ pathArr.push(test.parent.title);
112
+ return pathArr.filter(t => !!t)[0];
113
+ }
114
+ function getFile(test) {
115
+ return test.parent.file?.replace(process.cwd(), '');
116
+ }
117
+ function getTestName(test) {
118
+ if (process.env.TESTOMATIO_CREATE === 'fulltitle')
119
+ return test.fullTitle();
120
+ return test.title;
121
+ }
122
+ // To have this reporter "extend" a built-in reporter uncomment the following line:
123
+ // @ts-ignore
124
+ mocha_1.default.utils.inherits(MochaReporter, mocha_1.default.reporters.Spec);
125
+ module.exports = MochaReporter;