@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,52 +1,60 @@
1
- const { APP_PREFIX } = require('../constants');
2
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateFilterType = updateFilterType;
4
+ exports.parseFilterParams = parseFilterParams;
5
+ exports.generateFilterRequestParams = generateFilterRequestParams;
6
+ exports.setS3Credentials = setS3Credentials;
7
+ exports.statusEmoji = statusEmoji;
8
+ exports.fullName = fullName;
9
+ const fileUploader_js_1 = require("../fileUploader.js");
10
+ const constants_js_1 = require("../constants.js");
3
11
  /**
4
12
  * Set S3 credentials from the provided artifacts object.
5
13
  * @param {Object} artifacts - The artifacts object containing S3 credentials.
6
14
  */
7
15
  function setS3Credentials(artifacts) {
8
- if (!Object.keys(artifacts).length) return;
9
-
10
- console.log(APP_PREFIX, 'S3 were credentials obtained from Testomat.io...');
11
-
12
- if (artifacts.ACCESS_KEY_ID) process.env.S3_ACCESS_KEY_ID = artifacts.ACCESS_KEY_ID;
13
- if (artifacts.SECRET_ACCESS_KEY) process.env.S3_SECRET_ACCESS_KEY = artifacts.SECRET_ACCESS_KEY;
14
- if (artifacts.REGION) process.env.S3_REGION = artifacts.REGION;
15
- if (artifacts.BUCKET) process.env.S3_BUCKET = artifacts.BUCKET;
16
- if (artifacts.ENDPOINT) process.env.S3_ENDPOINT = artifacts.ENDPOINT;
17
- if (artifacts.SESSION_TOKEN) process.env.S3_SESSION_TOKEN = artifacts.SESSION_TOKEN;
18
- if (artifacts.presign) process.env.TESTOMATIO_PRIVATE_ARTIFACTS = '1';
16
+ if (!Object.keys(artifacts).length)
17
+ return;
18
+ console.log(constants_js_1.APP_PREFIX, 'S3 were credentials obtained from Testomat.io...');
19
+ if (artifacts.ACCESS_KEY_ID)
20
+ process.env.S3_ACCESS_KEY_ID = artifacts.ACCESS_KEY_ID;
21
+ if (artifacts.SECRET_ACCESS_KEY)
22
+ process.env.S3_SECRET_ACCESS_KEY = artifacts.SECRET_ACCESS_KEY;
23
+ if (artifacts.REGION)
24
+ process.env.S3_REGION = artifacts.REGION;
25
+ if (artifacts.BUCKET)
26
+ process.env.S3_BUCKET = artifacts.BUCKET;
27
+ if (artifacts.ENDPOINT)
28
+ process.env.S3_ENDPOINT = artifacts.ENDPOINT;
29
+ if (artifacts.SESSION_TOKEN)
30
+ process.env.S3_SESSION_TOKEN = artifacts.SESSION_TOKEN;
31
+ if (artifacts.presign)
32
+ process.env.TESTOMATIO_PRIVATE_ARTIFACTS = '1';
33
+ fileUploader_js_1.upload.resetConfig();
19
34
  }
20
35
  /**
21
36
  * Generates mode request parameters based on the input params.
22
- * @param {Object} params - The input parameters for the request.
23
- * @param {string} params.type - The type of the request (e.g., "tag").
24
- * @param {string} params.id - The ID associated with the request.
25
- * @param {string} params.apiKey - The API key for authentication.
37
+ * @param {{type: string, id?: string, apiKey: string}} params - The input parameters for the request.
26
38
  * @returns {Object|null} - An object containing the generated request parameters, or null if the type is invalid.
27
39
  */
28
40
  function generateFilterRequestParams(params) {
29
- const { type, id, apiKey } = params;
30
-
31
- if (!type) {
32
- return;
33
- }
34
-
35
- if (!id) {
36
- console.error(APP_PREFIX, `Please make sure your settings "${type.toUpperCase()}"= "${id}" is correct!`);
37
- return;
38
- }
39
-
40
- return {
41
- params: {
42
- type,
43
- id: encodeURIComponent(id),
44
- api_key: apiKey,
45
- },
46
- responseType: 'json',
47
- };
41
+ const { type, id, apiKey } = params;
42
+ if (!type) {
43
+ return;
44
+ }
45
+ if (!id) {
46
+ console.error(constants_js_1.APP_PREFIX, `Please make sure your settings "${type.toUpperCase()}"= "${id}" is correct!`);
47
+ return;
48
+ }
49
+ return {
50
+ params: {
51
+ type,
52
+ id: encodeURIComponent(id),
53
+ api_key: apiKey,
54
+ },
55
+ responseType: 'json',
56
+ };
48
57
  }
49
-
50
58
  /**
51
59
  * Parse filter parameters from a string in the format "type=id".
52
60
  * @param {string} opts - The input string containing the filter parameters.
@@ -54,15 +62,13 @@ function generateFilterRequestParams(params) {
54
62
  * The object has properties "type" and "id".
55
63
  */
56
64
  function parseFilterParams(opts) {
57
- const [type, id] = opts.split('=');
58
- const validType = updateFilterType(type);
59
-
60
- return {
61
- type: validType,
62
- id,
63
- };
65
+ const [type, id] = opts.split('=');
66
+ const validType = updateFilterType(type);
67
+ return {
68
+ type: validType,
69
+ id,
70
+ };
64
71
  }
65
-
66
72
  /**
67
73
  * Update and validate the filter type.
68
74
  * @param {string} type - The original filter type.
@@ -70,58 +76,59 @@ function parseFilterParams(opts) {
70
76
  * Returns undefined if the type is not valid.
71
77
  */
72
78
  function updateFilterType(type) {
73
- const typeLowerCase = type.toLowerCase();
74
-
75
- const filterTypes = ['tag-name', 'plan-id', 'label', 'jira-ticket'];
76
-
77
- const filterApi = [
78
- 'tag',
79
- 'plan',
80
- 'label',
81
- 'jira',
82
- // "ims-issue", //TODO: WIP
83
- ];
84
-
85
- if (!filterTypes.includes(typeLowerCase)) {
86
- console.log(APP_PREFIX, `❗❗❗ Invalid "filter=${type}" start settings! Available option list: ${filterTypes}`);
87
- return;
88
- }
89
-
90
- const index = filterTypes.indexOf(typeLowerCase);
91
-
92
- return index !== -1 ? filterApi[index] : undefined;
79
+ const typeLowerCase = type.toLowerCase();
80
+ const filterTypes = ['tag-name', 'plan-id', 'label', 'jira-ticket'];
81
+ const filterApi = [
82
+ 'tag',
83
+ 'plan',
84
+ 'label',
85
+ 'jira',
86
+ // "ims-issue", //TODO: WIP
87
+ ];
88
+ if (!filterTypes.includes(typeLowerCase)) {
89
+ console.log(constants_js_1.APP_PREFIX, `❗❗❗ Invalid "filter=${type}" start settings! Available option list: ${filterTypes}`);
90
+ return;
91
+ }
92
+ const index = filterTypes.indexOf(typeLowerCase);
93
+ return index !== -1 ? filterApi[index] : undefined;
93
94
  }
94
-
95
95
  /**
96
96
  * Return an emoji based on the provided status.
97
97
  * @param {string} status - The status value ('passed', 'failed', or 'skipped').
98
98
  * @returns {string} - An emoji corresponding to the provided status.
99
99
  */
100
100
  function statusEmoji(status) {
101
- if (status === 'passed') return '🟢';
102
- if (status === 'failed') return '🔴';
103
- if (status === 'skipped') return '🟡';
104
- return '';
101
+ if (status === 'passed')
102
+ return '🟢';
103
+ if (status === 'failed')
104
+ return '🔴';
105
+ if (status === 'skipped')
106
+ return '🟡';
107
+ return '';
105
108
  }
106
-
107
109
  /**
108
110
  * Generate a full name string based on the provided test object.
109
111
  * @param {object} t - The test object.
110
112
  * @returns {string} - A formatted full name string for the test object.
111
113
  */
112
114
  function fullName(t) {
113
- let line = '';
114
- if (t.suite_title) line = `${t.suite_title}: `;
115
- line += `**${t.title}**`;
116
- if (t.example) line += ` \`[${Object.values(t.example)}]\``;
117
- return line;
115
+ let line = '';
116
+ if (t.suite_title)
117
+ line = `${t.suite_title}: `;
118
+ line += `**${t.title}**`;
119
+ if (t.example)
120
+ line += ` \`[${Object.values(t.example)}]\``;
121
+ return line;
118
122
  }
119
123
 
120
- module.exports = {
121
- updateFilterType,
122
- parseFilterParams,
123
- generateFilterRequestParams,
124
- setS3Credentials,
125
- statusEmoji,
126
- fullName,
127
- };
124
+ module.exports.updateFilterType = updateFilterType;
125
+
126
+ module.exports.parseFilterParams = parseFilterParams;
127
+
128
+ module.exports.generateFilterRequestParams = generateFilterRequestParams;
129
+
130
+ module.exports.setS3Credentials = setS3Credentials;
131
+
132
+ module.exports.statusEmoji = statusEmoji;
133
+
134
+ module.exports.fullName = fullName;