@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.
- package/lib/adapter/codecept.js +288 -330
- package/lib/adapter/cucumber/current.js +195 -203
- package/lib/adapter/cucumber/legacy.js +130 -155
- package/lib/adapter/cucumber.js +5 -16
- package/lib/adapter/cypress-plugin/index.js +91 -105
- package/lib/adapter/jasmine/jasmine.js +63 -0
- package/lib/adapter/jasmine.js +54 -53
- package/lib/adapter/jest.js +97 -99
- package/lib/adapter/mocha/mocha.js +125 -0
- package/lib/adapter/mocha.js +111 -140
- package/lib/adapter/playwright.js +168 -200
- package/lib/adapter/vitest.js +144 -143
- package/lib/adapter/webdriver.js +113 -97
- package/lib/bin/reportXml.js +49 -49
- package/lib/bin/startTest.js +80 -97
- package/lib/client.js +344 -385
- package/lib/config.js +16 -21
- package/lib/constants.js +49 -43
- package/lib/data-storage.js +206 -188
- package/lib/fileUploader.js +245 -0
- package/lib/junit-adapter/adapter.js +17 -20
- package/lib/junit-adapter/csharp.js +18 -14
- package/lib/junit-adapter/index.js +27 -25
- package/lib/junit-adapter/java.js +41 -53
- package/lib/junit-adapter/javascript.js +30 -27
- package/lib/junit-adapter/python.js +38 -37
- package/lib/junit-adapter/ruby.js +11 -8
- package/lib/output.js +44 -52
- package/lib/package.json +1 -0
- package/lib/pipe/bitbucket.js +208 -227
- package/lib/pipe/csv.js +111 -124
- package/lib/pipe/github.js +184 -211
- package/lib/pipe/gitlab.js +164 -205
- package/lib/pipe/html.js +253 -312
- package/lib/pipe/index.js +83 -63
- package/lib/pipe/testomatio.js +391 -454
- package/lib/reporter-functions.js +16 -20
- package/lib/reporter.js +47 -17
- package/lib/services/artifacts.js +55 -51
- package/lib/services/index.js +14 -12
- package/lib/services/key-values.js +56 -53
- package/lib/services/logger.js +227 -245
- package/lib/utils/chalk.js +10 -0
- package/lib/utils/pipe_utils.js +91 -84
- package/lib/utils/utils.js +289 -273
- package/lib/xmlReader.js +480 -519
- package/package.json +57 -19
- package/src/adapter/codecept.js +369 -0
- package/src/adapter/cucumber/current.js +228 -0
- package/src/adapter/cucumber/legacy.js +158 -0
- package/src/adapter/cucumber.js +4 -0
- package/src/adapter/cypress-plugin/index.js +110 -0
- package/src/adapter/jasmine.js +60 -0
- package/src/adapter/jest.js +107 -0
- package/src/adapter/mocha.cjs +2 -0
- package/src/adapter/mocha.js +156 -0
- package/src/adapter/playwright.js +222 -0
- package/src/adapter/vitest.js +183 -0
- package/src/adapter/webdriver.js +111 -0
- package/src/bin/reportXml.js +67 -0
- package/src/bin/startTest.js +119 -0
- package/src/client.js +423 -0
- package/src/config.js +30 -0
- package/src/constants.js +49 -0
- package/src/data-storage.js +204 -0
- package/src/fileUploader.js +307 -0
- package/src/junit-adapter/adapter.js +23 -0
- package/src/junit-adapter/csharp.js +16 -0
- package/src/junit-adapter/index.js +28 -0
- package/src/junit-adapter/java.js +58 -0
- package/src/junit-adapter/javascript.js +31 -0
- package/src/junit-adapter/python.js +42 -0
- package/src/junit-adapter/ruby.js +10 -0
- package/src/output.js +57 -0
- package/src/pipe/bitbucket.js +254 -0
- package/src/pipe/csv.js +140 -0
- package/src/pipe/github.js +234 -0
- package/src/pipe/gitlab.js +229 -0
- package/src/pipe/html.js +366 -0
- package/src/pipe/index.js +73 -0
- package/src/pipe/testomatio.js +498 -0
- package/src/reporter-functions.js +44 -0
- package/src/reporter.cjs +22 -0
- package/src/reporter.js +24 -0
- package/src/services/artifacts.js +59 -0
- package/src/services/index.js +13 -0
- package/src/services/key-values.js +59 -0
- package/src/services/logger.js +314 -0
- package/src/template/emptyData.svg +23 -0
- package/src/template/testomatio.hbs +1421 -0
- package/src/utils/chalk.js +13 -0
- package/src/utils/pipe_utils.js +127 -0
- package/src/utils/utils.js +341 -0
- package/src/xmlReader.js +551 -0
- package/lib/bin/cli.js +0 -216
- package/lib/bin/uploadArtifacts.js +0 -86
- package/lib/uploader.js +0 -312
package/lib/bin/startTest.js
CHANGED
|
@@ -1,118 +1,101 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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`,
|
|
85
|
-
|
|
74
|
+
console.log(constants_js_1.APP_PREFIX, `🚀 Running`, picocolors_1.default.green(command));
|
|
86
75
|
if (!apiKey) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
99
|
+
commander_1.default.outputHelp();
|
|
116
100
|
}
|
|
117
|
-
|
|
118
|
-
program.parse(process.argv);
|
|
101
|
+
commander_1.default.parse(process.argv);
|