@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
package/lib/pipe/index.js CHANGED
@@ -1,67 +1,87 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const chalk = require('chalk');
4
- const { APP_PREFIX } = require('../constants');
5
- const TestomatioPipe = require('./testomatio');
6
- const GitHubPipe = require('./github');
7
- const GitLabPipe = require('./gitlab');
8
- const CsvPipe = require('./csv');
9
- const HtmlPipe = require('./html');
10
- const BitbucketPipe = require('./bitbucket');
11
-
12
- function PipeFactory(params, opts) {
13
- const extraPipes = [];
14
-
15
- // Add extra pipes into package.json file:
16
- // "testomatio": {
17
- // "pipes": ["my-module-pipe", "./local/js/file/pipe"]
18
- // }
19
-
20
- const packageJsonFile = path.join(process.cwd(), 'package.json');
21
- if (fs.existsSync(packageJsonFile)) {
22
- const packageJson = JSON.parse(fs.readFileSync(packageJsonFile).toString());
23
- const pipeDefs = packageJson?.testomatio?.pipes || [];
24
-
25
- for (const pipeDef of pipeDefs) {
26
- let PipeClass;
27
- try {
28
- PipeClass = require(pipeDef);
29
- } catch (err) {
30
- console.log(APP_PREFIX, `Can't load module Testomatio pipe module from ${pipeDef}`);
31
- continue;
32
- }
33
-
34
- try {
35
- extraPipes.push(new PipeClass(params, opts));
36
- } catch (err) {
37
- console.log(APP_PREFIX, `Can't instantiate Testomatio for ${pipeDef}`, err);
38
- continue;
39
- }
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]; } };
40
7
  }
41
- }
42
-
43
- const pipes = [
44
- new TestomatioPipe(params, opts),
45
- new GitHubPipe(params, opts),
46
- new GitLabPipe(params, opts),
47
- new CsvPipe(params, opts),
48
- new HtmlPipe(params, opts),
49
- new BitbucketPipe(params, opts),
50
- ...extraPipes,
51
- ];
52
-
53
- console.log(
54
- APP_PREFIX,
55
- chalk.cyan('Pipes:'),
56
- chalk.cyan(
57
- pipes
58
- .filter(p => p.isEnabled)
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 (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
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.pipesFactory = pipesFactory;
30
+ const fs_1 = __importDefault(require("fs"));
31
+ const path_1 = __importDefault(require("path"));
32
+ const picocolors_1 = __importDefault(require("picocolors"));
33
+ const constants_js_1 = require("../constants.js");
34
+ const testomatio_js_1 = __importDefault(require("./testomatio.js"));
35
+ const github_js_1 = __importDefault(require("./github.js"));
36
+ const gitlab_js_1 = __importDefault(require("./gitlab.js"));
37
+ const csv_js_1 = __importDefault(require("./csv.js"));
38
+ const html_js_1 = __importDefault(require("./html.js"));
39
+ const bitbucket_js_1 = require("./bitbucket.js");
40
+ async function pipesFactory(params, opts) {
41
+ const extraPipes = [];
42
+ // Add extra pipes into package.json file:
43
+ // "testomatio": {
44
+ // "pipes": ["my-module-pipe", "./local/js/file/pipe"]
45
+ // }
46
+ const packageJsonFile = path_1.default.join(process.cwd(), 'package.json');
47
+ if (fs_1.default.existsSync(packageJsonFile)) {
48
+ const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonFile).toString());
49
+ const pipeDefs = packageJson?.testomatio?.pipes || [];
50
+ for (const pipeDef of pipeDefs) {
51
+ let PipeClass;
52
+ try {
53
+ PipeClass = await Promise.resolve(`${pipeDef}`).then(s => __importStar(require(s)));
54
+ }
55
+ catch (err) {
56
+ console.log(constants_js_1.APP_PREFIX, `Can't load module Testomatio pipe module from ${pipeDef}`);
57
+ continue;
58
+ }
59
+ try {
60
+ extraPipes.push(new PipeClass(params, opts));
61
+ }
62
+ catch (err) {
63
+ console.log(constants_js_1.APP_PREFIX, `Can't instantiate Testomatio for ${pipeDef}`, err);
64
+ continue;
65
+ }
66
+ }
67
+ }
68
+ const pipes = [
69
+ new testomatio_js_1.default(params, opts),
70
+ new github_js_1.default(params, opts),
71
+ new gitlab_js_1.default(params, opts),
72
+ new csv_js_1.default(params, opts),
73
+ new html_js_1.default(params, opts),
74
+ new bitbucket_js_1.BitbucketPipe(params, opts),
75
+ ...extraPipes,
76
+ ];
77
+ 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
59
79
  .map(p => p.toString())
60
- .join(', ') || 'No pipes enabled',
61
- ),
62
- );
63
-
64
- return pipes;
80
+ .join(', ') || 'No pipes enabled'));
81
+ if (!pipesEnabled.length) {
82
+ 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
+ }
84
+ return pipes;
65
85
  }
66
86
 
67
- module.exports = PipeFactory;
87
+ module.exports.pipesFactory = pipesFactory;