@testomatio/reporter 2.0.0-beta-esm → 2.0.0-beta.1-xml

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 (123) hide show
  1. package/lib/adapter/codecept.d.ts +2 -0
  2. package/lib/adapter/codecept.js +31 -26
  3. package/lib/adapter/cucumber/current.d.ts +14 -0
  4. package/lib/adapter/cucumber/legacy.d.ts +0 -0
  5. package/lib/adapter/cucumber.d.ts +2 -0
  6. package/lib/adapter/cypress-plugin/index.d.ts +2 -0
  7. package/lib/adapter/cypress-plugin/index.js +10 -10
  8. package/lib/adapter/jasmine.d.ts +11 -0
  9. package/lib/adapter/jest.d.ts +13 -0
  10. package/lib/adapter/mocha.d.ts +2 -0
  11. package/lib/adapter/mocha.js +4 -4
  12. package/lib/adapter/nightwatch.d.ts +4 -0
  13. package/lib/adapter/nightwatch.js +80 -0
  14. package/lib/adapter/playwright.d.ts +14 -0
  15. package/lib/adapter/playwright.js +58 -33
  16. package/lib/adapter/vitest.d.ts +35 -0
  17. package/lib/adapter/vitest.js +6 -6
  18. package/lib/adapter/webdriver.d.ts +24 -0
  19. package/lib/adapter/webdriver.js +51 -14
  20. package/lib/bin/cli.d.ts +2 -0
  21. package/lib/bin/cli.js +250 -0
  22. package/lib/bin/reportXml.d.ts +2 -0
  23. package/lib/bin/reportXml.js +15 -11
  24. package/lib/bin/startTest.d.ts +2 -0
  25. package/lib/bin/startTest.js +12 -7
  26. package/lib/bin/uploadArtifacts.d.ts +2 -0
  27. package/lib/bin/uploadArtifacts.js +82 -0
  28. package/lib/client.d.ts +76 -0
  29. package/lib/client.js +128 -53
  30. package/lib/config.d.ts +1 -0
  31. package/lib/config.js +2 -2
  32. package/lib/constants.d.ts +25 -0
  33. package/lib/constants.js +5 -1
  34. package/lib/data-storage.d.ts +34 -0
  35. package/lib/data-storage.js +19 -9
  36. package/lib/junit-adapter/adapter.d.ts +9 -0
  37. package/lib/junit-adapter/csharp.d.ts +5 -0
  38. package/lib/junit-adapter/csharp.js +11 -1
  39. package/lib/junit-adapter/index.d.ts +3 -0
  40. package/lib/junit-adapter/java.d.ts +5 -0
  41. package/lib/junit-adapter/javascript.d.ts +4 -0
  42. package/lib/junit-adapter/python.d.ts +5 -0
  43. package/lib/junit-adapter/ruby.d.ts +4 -0
  44. package/lib/output.d.ts +11 -0
  45. package/lib/package.json +3 -1
  46. package/lib/pipe/bitbucket.d.ts +23 -0
  47. package/lib/pipe/bitbucket.js +19 -9
  48. package/lib/pipe/csv.d.ts +47 -0
  49. package/lib/pipe/csv.js +2 -2
  50. package/lib/pipe/debug.d.ts +29 -0
  51. package/lib/pipe/debug.js +108 -0
  52. package/lib/pipe/github.d.ts +30 -0
  53. package/lib/pipe/github.js +37 -5
  54. package/lib/pipe/gitlab.d.ts +23 -0
  55. package/lib/pipe/gitlab.js +2 -3
  56. package/lib/pipe/html.d.ts +35 -0
  57. package/lib/pipe/html.js +9 -4
  58. package/lib/pipe/index.d.ts +1 -0
  59. package/lib/pipe/index.js +20 -10
  60. package/lib/pipe/testomatio.d.ts +70 -0
  61. package/lib/pipe/testomatio.js +54 -39
  62. package/lib/reporter-functions.d.ts +34 -0
  63. package/lib/reporter-functions.js +17 -7
  64. package/lib/reporter.d.ts +232 -0
  65. package/lib/reporter.js +19 -33
  66. package/lib/services/artifacts.d.ts +33 -0
  67. package/lib/services/index.d.ts +9 -0
  68. package/lib/services/key-values.d.ts +27 -0
  69. package/lib/services/key-values.js +1 -1
  70. package/lib/services/logger.d.ts +64 -0
  71. package/lib/services/logger.js +1 -2
  72. package/lib/template/testomatio.hbs +651 -1366
  73. package/lib/uploader.d.ts +60 -0
  74. package/lib/uploader.js +312 -0
  75. package/lib/utils/pipe_utils.d.ts +41 -0
  76. package/lib/utils/pipe_utils.js +3 -5
  77. package/lib/utils/utils.d.ts +47 -0
  78. package/lib/utils/utils.js +99 -12
  79. package/lib/xmlReader.d.ts +92 -0
  80. package/lib/xmlReader.js +64 -25
  81. package/package.json +19 -13
  82. package/src/adapter/codecept.js +30 -26
  83. package/src/adapter/cypress-plugin/index.js +5 -5
  84. package/src/adapter/mocha.cjs +1 -1
  85. package/src/adapter/mocha.js +4 -4
  86. package/src/adapter/nightwatch.js +88 -0
  87. package/src/adapter/playwright.js +59 -31
  88. package/src/adapter/vitest.js +6 -6
  89. package/src/adapter/webdriver.js +42 -12
  90. package/src/bin/cli.js +303 -0
  91. package/src/bin/reportXml.js +19 -9
  92. package/src/bin/startTest.js +9 -4
  93. package/src/bin/uploadArtifacts.js +91 -0
  94. package/src/client.js +137 -57
  95. package/src/config.js +2 -2
  96. package/src/constants.js +5 -1
  97. package/src/data-storage.js +2 -2
  98. package/src/junit-adapter/csharp.js +13 -1
  99. package/src/pipe/bitbucket.js +2 -2
  100. package/src/pipe/csv.js +3 -3
  101. package/src/pipe/debug.js +104 -0
  102. package/src/pipe/github.js +3 -5
  103. package/src/pipe/gitlab.js +6 -7
  104. package/src/pipe/html.js +14 -7
  105. package/src/pipe/index.js +5 -7
  106. package/src/pipe/testomatio.js +75 -76
  107. package/src/reporter-functions.js +18 -7
  108. package/src/reporter.cjs_decprecated +21 -0
  109. package/src/reporter.js +20 -11
  110. package/src/services/key-values.js +1 -1
  111. package/src/services/logger.js +5 -4
  112. package/src/template/testomatio.hbs +651 -1366
  113. package/src/uploader.js +371 -0
  114. package/src/utils/pipe_utils.js +4 -12
  115. package/src/utils/utils.js +64 -15
  116. package/src/xmlReader.js +76 -26
  117. package/lib/adapter/jasmine/jasmine.js +0 -63
  118. package/lib/adapter/mocha/mocha.js +0 -125
  119. package/lib/fileUploader.js +0 -245
  120. package/lib/utils/chalk.js +0 -10
  121. package/src/fileUploader.js +0 -307
  122. package/src/reporter.cjs +0 -22
  123. package/src/utils/chalk.js +0 -13
@@ -0,0 +1,29 @@
1
+ export class DebugPipe {
2
+ constructor(params: any, store: any);
3
+ params: any;
4
+ store: any;
5
+ isEnabled: boolean;
6
+ batch: {
7
+ isEnabled: any;
8
+ intervalFunction: any;
9
+ intervalTime: number;
10
+ tests: any[];
11
+ batchIndex: number;
12
+ };
13
+ logFilePath: string;
14
+ testomatioEnvVars: {};
15
+ batchUpload(): Promise<void>;
16
+ /**
17
+ * Logs data to a file if logging is enabled.
18
+ *
19
+ * @param {Object} logData - The data to be logged.
20
+ * @returns {Promise<void>} A promise that resolves when the log data has been appended to the file.
21
+ */
22
+ logToFile(logData: any): Promise<void>;
23
+ lastActionTimestamp: number;
24
+ prepareRun(opts: any): Promise<any[]>;
25
+ createRun(params?: {}): Promise<{}>;
26
+ addTest(data: any): Promise<void>;
27
+ finishRun(params: any): Promise<void>;
28
+ toString(): string;
29
+ }
@@ -0,0 +1,108 @@
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.DebugPipe = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const os_1 = __importDefault(require("os"));
10
+ const debug_1 = __importDefault(require("debug"));
11
+ const constants_js_1 = require("../constants.js");
12
+ const pretty_ms_1 = __importDefault(require("pretty-ms"));
13
+ const debug = (0, debug_1.default)('@testomatio/reporter:pipe:debug');
14
+ class DebugPipe {
15
+ constructor(params, store) {
16
+ this.params = params || {};
17
+ this.store = store || {};
18
+ this.isEnabled = !!process.env.TESTOMATIO_DEBUG || !!process.env.DEBUG;
19
+ if (this.isEnabled) {
20
+ this.batch = {
21
+ isEnabled: this.params.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD ?? true,
22
+ intervalFunction: null,
23
+ intervalTime: 5000,
24
+ tests: [],
25
+ batchIndex: 0,
26
+ };
27
+ this.logFilePath = path_1.default.join(os_1.default.tmpdir(), `testomatio.debug.${Date.now()}.json`);
28
+ debug('Creating debug file:', this.logFilePath);
29
+ fs_1.default.writeFileSync(this.logFilePath, '');
30
+ console.log(constants_js_1.APP_PREFIX, '🪲. Debug created:');
31
+ this.testomatioEnvVars = Object.keys(process.env)
32
+ .filter(key => key.startsWith('TESTOMATIO_'))
33
+ .reduce((acc, key) => {
34
+ acc[key] = process.env[key];
35
+ return acc;
36
+ }, {});
37
+ this.logToFile({ datetime: new Date().toISOString(), timestamp: Date.now() });
38
+ this.logToFile({ data: 'variables', testomatioEnvVars: this.testomatioEnvVars });
39
+ this.logToFile({ data: 'store', store: this.store || {} });
40
+ // Bind batchUpload to the instance
41
+ this.batchUpload = this.batchUpload.bind(this);
42
+ }
43
+ }
44
+ /**
45
+ * Logs data to a file if logging is enabled.
46
+ *
47
+ * @param {Object} logData - The data to be logged.
48
+ * @returns {Promise<void>} A promise that resolves when the log data has been appended to the file.
49
+ */
50
+ logToFile(logData) {
51
+ if (!this.isEnabled)
52
+ return;
53
+ const timePassedFromLastAction = Date.now() - (this.lastActionTimestamp || Date.now());
54
+ this.lastActionTimestamp = Date.now();
55
+ const logLine = JSON.stringify({ t: `+${(0, pretty_ms_1.default)(timePassedFromLastAction)}`, ...logData });
56
+ fs_1.default.appendFileSync(this.logFilePath, `${logLine}\n`);
57
+ }
58
+ async prepareRun(opts) {
59
+ if (!this.isEnabled)
60
+ return [];
61
+ this.logToFile({ action: 'prepareRun', data: opts });
62
+ }
63
+ async createRun(params = {}) {
64
+ if (!this.isEnabled)
65
+ return;
66
+ if (params.isBatchEnabled === true || params.isBatchEnabled === false)
67
+ this.batch.isEnabled = params.isBatchEnabled;
68
+ if (!this.isEnabled)
69
+ return {};
70
+ if (this.batch.isEnabled)
71
+ this.batch.intervalFunction = setInterval(this.batchUpload, this.batch.intervalTime);
72
+ this.logToFile({ action: 'createRun', params });
73
+ }
74
+ async addTest(data) {
75
+ if (!this.isEnabled)
76
+ return;
77
+ if (!this.batch.isEnabled)
78
+ this.logToFile({ action: 'addTest', testId: data });
79
+ else
80
+ this.batch.tests.push(data);
81
+ if (!this.batch.intervalFunction)
82
+ await this.batchUpload();
83
+ }
84
+ async batchUpload() {
85
+ this.batch.batchIndex++;
86
+ if (!this.batch.isEnabled)
87
+ return;
88
+ if (!this.batch.tests.length)
89
+ return;
90
+ const testsToSend = this.batch.tests.splice(0);
91
+ this.logToFile({ action: 'addTestsBatch', tests: testsToSend });
92
+ }
93
+ async finishRun(params) {
94
+ if (!this.isEnabled)
95
+ return;
96
+ this.logToFile({ actions: 'finishRun', params });
97
+ await this.batchUpload();
98
+ if (this.batch.intervalFunction)
99
+ clearInterval(this.batch.intervalFunction);
100
+ console.log(constants_js_1.APP_PREFIX, '🪲. Debug Saved to', this.logFilePath);
101
+ }
102
+ toString() {
103
+ return 'Debug Reporter';
104
+ }
105
+ }
106
+ exports.DebugPipe = DebugPipe;
107
+
108
+ module.exports.DebugPipe = DebugPipe;
@@ -0,0 +1,30 @@
1
+ export default GitHubPipe;
2
+ export type Pipe = import("../../types/types.js").Pipe;
3
+ export type TestData = import("../../types/types.js").TestData;
4
+ /**
5
+ * @typedef {import('../../types/types.js').Pipe} Pipe
6
+ * @typedef {import('../../types/types.js').TestData} TestData
7
+ * @class GitHubPipe
8
+ * @implements {Pipe}
9
+ */
10
+ declare class GitHubPipe implements Pipe {
11
+ constructor(params: any, store?: {});
12
+ isEnabled: boolean;
13
+ store: {};
14
+ tests: any[];
15
+ token: any;
16
+ ref: string;
17
+ repo: string;
18
+ jobKey: string;
19
+ hiddenCommentData: string;
20
+ issue: number;
21
+ start: Date;
22
+ prepareRun(): Promise<void>;
23
+ createRun(): Promise<void>;
24
+ addTest(test: any): void;
25
+ finishRun(runParams: any): Promise<void>;
26
+ octokit: import("@octokit/core").Octokit & import("@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types.js").RestEndpointMethods & import("@octokit/plugin-rest-endpoint-methods").Api & {
27
+ paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
28
+ };
29
+ toString(): string;
30
+ }
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
@@ -8,14 +41,13 @@ const path_1 = __importDefault(require("path"));
8
41
  const picocolors_1 = __importDefault(require("picocolors"));
9
42
  const humanize_duration_1 = __importDefault(require("humanize-duration"));
10
43
  const lodash_merge_1 = __importDefault(require("lodash.merge"));
11
- const rest_1 = require("@octokit/rest");
12
44
  const constants_js_1 = require("../constants.js");
13
45
  const utils_js_1 = require("../utils/utils.js");
14
46
  const pipe_utils_js_1 = require("../utils/pipe_utils.js");
15
47
  const debug = (0, debug_1.default)('@testomatio/reporter:pipe:github');
16
48
  /**
17
- * @typedef {import('../../types').Pipe} Pipe
18
- * @typedef {import('../../types').TestData} TestData
49
+ * @typedef {import('../../types/types.js').Pipe} Pipe
50
+ * @typedef {import('../../types/types.js').TestData} TestData
19
51
  * @class GitHubPipe
20
52
  * @implements {Pipe}
21
53
  */
@@ -62,7 +94,8 @@ class GitHubPipe {
62
94
  return;
63
95
  if (runParams.tests)
64
96
  runParams.tests.forEach(t => this.addTest(t));
65
- this.octokit = new rest_1.Octokit({
97
+ const { Octokit } = await Promise.resolve().then(() => __importStar(require('@octokit/rest')));
98
+ this.octokit = new Octokit({
66
99
  auth: this.token,
67
100
  });
68
101
  const [owner, repo] = (this.repo || '').split('/');
@@ -130,7 +163,6 @@ class GitHubPipe {
130
163
  if (this.tests.length > 0) {
131
164
  body += '\n<details>\n<summary><h3>🐢 Slowest Tests</h3></summary>\n\n';
132
165
  body += this.tests
133
- // eslint-disable-next-line no-unsafe-optional-chaining
134
166
  .sort((a, b) => b?.run_time - a?.run_time)
135
167
  .slice(0, 5)
136
168
  .map(t => `* ${(0, pipe_utils_js_1.fullName)(t)} (${(0, humanize_duration_1.default)(parseFloat(t.run_time))})`)
@@ -0,0 +1,23 @@
1
+ export default GitLabPipe;
2
+ export type Pipe = import("../../types/types.js").Pipe;
3
+ export type TestData = import("../../types/types.js").TestData;
4
+ /**
5
+ * @class GitLabPipe
6
+ * @typedef {import('../../types/types.js').Pipe} Pipe
7
+ * @typedef {import('../../types/types.js').TestData} TestData
8
+ */
9
+ declare class GitLabPipe {
10
+ constructor(params: any, store?: {});
11
+ isEnabled: boolean;
12
+ ENV: NodeJS.ProcessEnv;
13
+ store: {};
14
+ tests: any[];
15
+ token: any;
16
+ hiddenCommentData: string;
17
+ prepareRun(): Promise<void>;
18
+ createRun(): Promise<void>;
19
+ addTest(test: any): void;
20
+ finishRun(runParams: any): Promise<void>;
21
+ toString(): string;
22
+ updateRun(): void;
23
+ }
@@ -17,8 +17,8 @@ const debug = (0, debug_1.default)('@testomatio/reporter:pipe:gitlab');
17
17
  //! and your pipeline trigger should be merge_request
18
18
  /**
19
19
  * @class GitLabPipe
20
- * @typedef {import('../../types').Pipe} Pipe
21
- * @typedef {import('../../types').TestData} TestData
20
+ * @typedef {import('../../types/types.js').Pipe} Pipe
21
+ * @typedef {import('../../types/types.js').TestData} TestData
22
22
  */
23
23
  class GitLabPipe {
24
24
  constructor(params, store = {}) {
@@ -119,7 +119,6 @@ class GitLabPipe {
119
119
  if (this.tests.length > 0) {
120
120
  body += '\n<details>\n<summary><h3>🐢 Slowest Tests</h3></summary>\n\n';
121
121
  body += this.tests
122
- // eslint-disable-next-line no-unsafe-optional-chaining
123
122
  .sort((a, b) => b?.run_time - a?.run_time)
124
123
  .slice(0, 5)
125
124
  .map(t => `* ${(0, pipe_utils_js_1.fullName)(t)} (${(0, humanize_duration_1.default)(parseFloat(t.run_time))})`)
@@ -0,0 +1,35 @@
1
+ export default HtmlPipe;
2
+ declare class HtmlPipe {
3
+ constructor(params: any, store?: {});
4
+ store: {};
5
+ title: any;
6
+ apiKey: any;
7
+ isHtml: string;
8
+ isEnabled: boolean;
9
+ htmlOutputPath: string;
10
+ fullHtmlOutputPath: string;
11
+ filenameMsg: string;
12
+ tests: any[];
13
+ htmlReportDir: string;
14
+ htmlReportName: string;
15
+ templateFolderPath: string;
16
+ templateHtmlPath: string;
17
+ createRun(): Promise<void>;
18
+ prepareRun(): Promise<void>;
19
+ updateRun(): void;
20
+ /**
21
+ * Add test data to the result array for saving. As a result of this function, we get a result object to save.
22
+ * @param {import('../../types/types.js').RunData} test - object which includes each test entry.
23
+ */
24
+ addTest(test: import("../../types/types.js").RunData): void;
25
+ finishRun(runParams: any): Promise<void>;
26
+ /**
27
+ * Generates an HTML report based on provided test data and a template.
28
+ * @param {object} opts - Test options used to generate the HTML report:
29
+ * runParams, tests, outputPath, templatePath
30
+ * @returns {void} - This function does not return anything.
31
+ */
32
+ buildReport(opts: object): void;
33
+ toString(): string;
34
+ #private;
35
+ }
package/lib/pipe/html.js CHANGED
@@ -53,12 +53,13 @@ class HtmlPipe {
53
53
  async createRun() {
54
54
  // empty
55
55
  }
56
+ async prepareRun() { }
56
57
  updateRun() {
57
58
  // empty
58
59
  }
59
60
  /**
60
61
  * Add test data to the result array for saving. As a result of this function, we get a result object to save.
61
- * @param {import('../../types').RunData} test - object which includes each test entry.
62
+ * @param {import('../../types/types.js').RunData} test - object which includes each test entry.
62
63
  */
63
64
  addTest(test) {
64
65
  if (!this.isEnabled)
@@ -106,6 +107,13 @@ class HtmlPipe {
106
107
  console.log(picocolors_1.default.blue(msg));
107
108
  }
108
109
  tests.forEach(test => {
110
+ // steps could be an array or a string
111
+ test.steps = Array.isArray(test.steps)
112
+ ? (test.steps = test.steps
113
+ .map(step => (0, utils_js_1.formatStep)(step))
114
+ .flat()
115
+ .join('\n'))
116
+ : test.steps;
109
117
  if (!test.message?.trim()) {
110
118
  test.message = "This test has no 'message' code";
111
119
  }
@@ -185,7 +193,6 @@ class HtmlPipe {
185
193
  <option value="1">25</option>
186
194
  <option value="2">50</option>
187
195
  </select>`));
188
- /* eslint-disable */
189
196
  handlebars_1.default.registerHelper('emptyDataComponent', () => {
190
197
  const svgFilePath = path_1.default.join(__dirname, '..', 'template', 'emptyData.svg');
191
198
  const svgContent = fs_1.default.readFileSync(svgFilePath, 'utf8');
@@ -199,7 +206,6 @@ class HtmlPipe {
199
206
  </div>
200
207
  <div>`);
201
208
  });
202
- /* eslint-enable */
203
209
  handlebars_1.default.registerHelper('pageDispleyElements', tests => {
204
210
  // We wrapp the lines to the HTML format we need
205
211
  const totalTests = JSON.parse(JSON.stringify(tests)
@@ -227,7 +233,6 @@ class HtmlPipe {
227
233
  }
228
234
  statuses.forEach(status => {
229
235
  for (const option in paginationOptions) {
230
- // eslint-disable-next-line no-prototype-builtins
231
236
  if (paginationOptions.hasOwnProperty(option)) {
232
237
  const pageSize = paginationOptions[option];
233
238
  let filteredItems = totalTests;
@@ -0,0 +1 @@
1
+ export function pipesFactory(params: any, opts: any): Promise<any[]>;
package/lib/pipe/index.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -37,6 +47,7 @@ const gitlab_js_1 = __importDefault(require("./gitlab.js"));
37
47
  const csv_js_1 = __importDefault(require("./csv.js"));
38
48
  const html_js_1 = __importDefault(require("./html.js"));
39
49
  const bitbucket_js_1 = require("./bitbucket.js");
50
+ const debug_js_1 = require("./debug.js");
40
51
  async function pipesFactory(params, opts) {
41
52
  const extraPipes = [];
42
53
  // Add extra pipes into package.json file:
@@ -72,12 +83,11 @@ async function pipesFactory(params, opts) {
72
83
  new csv_js_1.default(params, opts),
73
84
  new html_js_1.default(params, opts),
74
85
  new bitbucket_js_1.BitbucketPipe(params, opts),
86
+ new debug_js_1.DebugPipe(params, opts),
75
87
  ...extraPipes,
76
88
  ];
77
89
  const pipesEnabled = pipes.filter(p => p.isEnabled);
78
- console.log(constants_js_1.APP_PREFIX, picocolors_1.default.cyan('Pipes:'), picocolors_1.default.cyan(pipesEnabled
79
- .map(p => p.toString())
80
- .join(', ') || 'No pipes enabled'));
90
+ console.log(constants_js_1.APP_PREFIX, picocolors_1.default.cyan('Pipes:'), picocolors_1.default.cyan(pipesEnabled.map(p => p.toString()).join(', ') || 'No pipes enabled'));
81
91
  if (!pipesEnabled.length) {
82
92
  console.log(constants_js_1.APP_PREFIX, picocolors_1.default.dim('If you want to use Testomatio reporter, pass your token as TESTOMATIO env variable'));
83
93
  }
@@ -0,0 +1,70 @@
1
+ export default TestomatioPipe;
2
+ export type Pipe = import("../../types/types.js").Pipe;
3
+ export type TestData = import("../../types/types.js").TestData;
4
+ /**
5
+ * @typedef {import('../../types/types.js').Pipe} Pipe
6
+ * @typedef {import('../../types/types.js').TestData} TestData
7
+ * @class TestomatioPipe
8
+ * @implements {Pipe}
9
+ */
10
+ declare class TestomatioPipe implements Pipe {
11
+ constructor(params: any, store: any);
12
+ batch: {
13
+ isEnabled: any;
14
+ intervalFunction: any;
15
+ intervalTime: number;
16
+ tests: any[];
17
+ batchIndex: number;
18
+ numberOfTimesCalledWithoutTests: number;
19
+ };
20
+ retriesTimestamps: any[];
21
+ reportingCanceledDueToReqFailures: boolean;
22
+ notReportedTestsCount: number;
23
+ isEnabled: boolean;
24
+ url: any;
25
+ apiKey: any;
26
+ parallel: any;
27
+ store: any;
28
+ title: any;
29
+ sharedRun: boolean;
30
+ sharedRunTimeout: boolean;
31
+ groupTitle: any;
32
+ env: string;
33
+ label: string;
34
+ axios: import("axios").AxiosInstance;
35
+ proceed: string;
36
+ jiraId: string;
37
+ runId: any;
38
+ createNewTests: any;
39
+ hasUnmatchedTests: boolean;
40
+ requestFailures: number;
41
+ /**
42
+ * Asynchronously prepares and retrieves the Testomat.io test grepList based on the provided options.
43
+ * @param {Object} opts - The options for preparing the test grepList.
44
+ * @returns {Promise<string[]>} - An array containing the retrieved
45
+ * test grepList, or an empty array if no tests are found or the request is disabled.
46
+ * @throws {Error} - Throws an error if there was a problem while making the request.
47
+ */
48
+ prepareRun(opts: any): Promise<string[]>;
49
+ /**
50
+ * Creates a new run on Testomat.io
51
+ * @param {{isBatchEnabled?: boolean}} params
52
+ * @returns Promise<void>
53
+ */
54
+ createRun(params?: {
55
+ isBatchEnabled?: boolean;
56
+ }): Promise<void>;
57
+ runUrl: string;
58
+ runPublicUrl: any;
59
+ /**
60
+ * Adds a test to the batch uploader (or reports a single test if batch uploading is disabled)
61
+ */
62
+ addTest(data: any): void;
63
+ /**
64
+ * @param {import('../../types/types.js').RunData} params
65
+ * @returns
66
+ */
67
+ finishRun(params: import("../../types/types.js").RunData): Promise<void>;
68
+ toString(): string;
69
+ #private;
70
+ }