@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,118 +1,101 @@
1
1
  #!/usr/bin/env node
2
- const spawn = require('cross-spawn');
3
- const program = require('commander');
4
- const chalk = require('chalk');
5
- const TestomatClient = require('../client');
6
- const { APP_PREFIX, STATUS } = require('../constants');
7
- const { version } = require('../../package.json');
8
- const config = require('../config');
9
-
10
- console.log(chalk.cyan.bold(` 🤩 Testomat.io Reporter v${version}`));
11
-
12
- program
13
- .option('-c, --command <cmd>', 'Test runner command')
14
- .option('--launch', 'Start a new run and return its ID')
15
- .option('--finish', 'Finish Run by its ID')
16
- .option('--env-file <envfile>', 'Load environment variables from env file')
17
- .option('--filter <filter>', 'Additional execution filter')
18
- .action(async opts => {
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const cross_spawn_1 = require("cross-spawn");
8
+ const commander_1 = __importDefault(require("commander"));
9
+ const picocolors_1 = __importDefault(require("picocolors"));
10
+ const client_js_1 = __importDefault(require("../client.js"));
11
+ const constants_js_1 = require("../constants.js");
12
+ const package_json_1 = require("../../package.json");
13
+ const config_js_1 = require("../config.js");
14
+ console.log(picocolors_1.default.cyan(picocolors_1.default.bold(` 🤩 Testomat.io Reporter v${package_json_1.version}`)));
15
+ commander_1.default
16
+ .option('-c, --command <cmd>', 'Test runner command')
17
+ .option('--launch', 'Start a new run and return its ID')
18
+ .option('--finish', 'Finish Run by its ID')
19
+ .option('--env-file <envfile>', 'Load environment variables from env file')
20
+ .option('--filter <filter>', 'Additional execution filter')
21
+ .action(async (opts) => {
19
22
  const { launch, finish, filter } = opts;
20
23
  let { command } = opts;
21
-
22
- if (opts.envFile) require('dotenv').config(opts.envFile); // eslint-disable-line
23
-
24
- const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || config.TESTOMATIO;
24
+ if (opts.envFile)
25
+ require('dotenv').config(opts.envFile); // eslint-disable-line
26
+ const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || config_js_1.config.TESTOMATIO;
25
27
  const title = process.env.TESTOMATIO_TITLE;
26
-
27
28
  if (launch) {
28
- console.log('Starting a new Run on Testomat.io...');
29
- const client = new TestomatClient({ apiKey });
30
-
31
- client.createRun().then(() => {
32
- console.log(process.env.runId);
33
- process.exit(0);
34
- });
35
- return;
29
+ console.log('Starting a new Run on Testomat.io...');
30
+ const client = new client_js_1.default({ apiKey });
31
+ client.createRun().then(() => {
32
+ console.log(process.env.runId);
33
+ process.exit(0);
34
+ });
35
+ return;
36
36
  }
37
-
38
37
  if (finish) {
39
- if (!process.env.TESTOMATIO_RUN) {
40
- console.log('TESTOMATIO_RUN environment variable must be set.');
41
- return process.exit(1);
42
- }
43
-
44
- console.log('Finishing Run on Testomat.io...');
45
-
46
- const client = new TestomatClient({ apiKey });
47
-
48
- client.updateRunStatus(STATUS.FINISHED).then(() => {
49
- console.log(chalk.yellow(`Run ${process.env.TESTOMATIO_RUN} was finished`));
50
- process.exit(0);
51
- });
52
- return;
38
+ if (!process.env.TESTOMATIO_RUN) {
39
+ console.log('TESTOMATIO_RUN environment variable must be set.');
40
+ return process.exit(1);
41
+ }
42
+ console.log('Finishing Run on Testomat.io...');
43
+ const client = new client_js_1.default({ apiKey });
44
+ // @ts-ignore
45
+ client.updateRunStatus(constants_js_1.STATUS.FINISHED).then(() => {
46
+ console.log(picocolors_1.default.yellow(`Run ${process.env.TESTOMATIO_RUN} was finished`));
47
+ process.exit(0);
48
+ });
49
+ return;
53
50
  }
54
-
55
51
  let exitCode = 0;
56
-
57
52
  if (!command.split) {
58
- process.exitCode = 255;
59
- console.log(APP_PREFIX, `No command provided. Use -c option to launch a test runner.`);
60
- return;
53
+ process.exitCode = 255;
54
+ console.log(constants_js_1.APP_PREFIX, `No command provided. Use -c option to launch a test runner.`);
55
+ return;
61
56
  }
62
-
63
- const client = new TestomatClient({ apiKey, title, parallel: true });
64
-
57
+ const client = new client_js_1.default({ apiKey, title, parallel: true });
65
58
  if (filter) {
66
- const [pipe, ...optsArray] = filter.split(':');
67
- const pipeOptions = optsArray.join(':');
68
-
69
- try {
70
- const tests = await client.prepareRun({ pipe, pipeOptions });
71
-
72
- if (!tests || tests.length === 0) {
73
- return;
59
+ const [pipe, ...optsArray] = filter.split(':');
60
+ const pipeOptions = optsArray.join(':');
61
+ try {
62
+ const tests = await client.prepareRun({ pipe, pipeOptions });
63
+ if (!tests || tests.length === 0) {
64
+ return;
65
+ }
66
+ const grep = ` --grep (${tests.join('|')})`;
67
+ command += grep;
68
+ }
69
+ catch (err) {
70
+ console.log(constants_js_1.APP_PREFIX, err);
74
71
  }
75
-
76
- const grep = ` --grep (${tests.join('|')})`;
77
- command += grep;
78
- } catch (err) {
79
- console.log(APP_PREFIX, err);
80
- }
81
72
  }
82
-
83
73
  const testCmds = command.split(' ');
84
- console.log(APP_PREFIX, `🚀 Running`, chalk.green(command));
85
-
74
+ console.log(constants_js_1.APP_PREFIX, `🚀 Running`, picocolors_1.default.green(command));
86
75
  if (!apiKey) {
87
- const cmd = spawn(testCmds[0], testCmds.slice(1), { stdio: 'inherit' });
88
-
89
- cmd.on('close', code => {
90
- console.log(APP_PREFIX, '⚠️ ', `Runner exited with ${chalk.bold(code)}, report is ignored`);
91
-
92
- if (code > exitCode) exitCode = code;
93
- process.exitCode = exitCode;
94
- });
95
-
96
- return;
76
+ const cmd = (0, cross_spawn_1.spawn)(testCmds[0], testCmds.slice(1), { stdio: 'inherit' });
77
+ cmd.on('close', code => {
78
+ console.log(constants_js_1.APP_PREFIX, '⚠️ ', `Runner exited with ${picocolors_1.default.bold(code)}, report is ignored`);
79
+ if (code > exitCode)
80
+ exitCode = code;
81
+ process.exitCode = exitCode;
82
+ });
83
+ return;
97
84
  }
98
-
99
85
  client.createRun().then(() => {
100
- const cmd = spawn(testCmds[0], testCmds.slice(1), { stdio: 'inherit' });
101
-
102
- cmd.on('close', code => {
103
- const emoji = code === 0 ? '🟢' : '🔴';
104
- console.log(APP_PREFIX, emoji, `Runner exited with ${chalk.bold(code)}`);
105
- const status = code === 0 ? 'passed' : 'failed';
106
- client.updateRunStatus(status, true);
107
-
108
- if (code > exitCode) exitCode = code;
109
- process.exitCode = exitCode;
110
- });
86
+ const cmd = (0, cross_spawn_1.spawn)(testCmds[0], testCmds.slice(1), { stdio: 'inherit' });
87
+ cmd.on('close', code => {
88
+ const emoji = code === 0 ? '🟢' : '🔴';
89
+ console.log(constants_js_1.APP_PREFIX, emoji, `Runner exited with ${picocolors_1.default.bold(code)}`);
90
+ const status = code === 0 ? 'passed' : 'failed';
91
+ client.updateRunStatus(status, true);
92
+ if (code > exitCode)
93
+ exitCode = code;
94
+ process.exitCode = exitCode;
95
+ });
111
96
  });
112
- });
113
-
97
+ });
114
98
  if (process.argv.length <= 2) {
115
- program.outputHelp();
99
+ commander_1.default.outputHelp();
116
100
  }
117
-
118
- program.parse(process.argv);
101
+ commander_1.default.parse(process.argv);