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