@mablhq/mabl-cli 1.45.1 → 1.45.8
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.
|
@@ -9,6 +9,7 @@ const mablApi_1 = require("../../../mablApi");
|
|
|
9
9
|
const reporter_1 = require("../../../reporters/reporter");
|
|
10
10
|
const browserTypes_1 = require("../../browserTypes");
|
|
11
11
|
const execution_1 = require("../../../execution");
|
|
12
|
+
const defaultEnv_1 = require("../../../env/defaultEnv");
|
|
12
13
|
const chalk = require('chalk');
|
|
13
14
|
const execution = require('../../../execution/index');
|
|
14
15
|
exports.command = `run`;
|
|
@@ -269,9 +270,13 @@ async function run(parsed) {
|
|
|
269
270
|
if (results.numFailedTests) {
|
|
270
271
|
results.testResults.forEach((result) => {
|
|
271
272
|
if (result.status === 'failed') {
|
|
272
|
-
loggingProvider_1.logger.info(chalk.red(` - ${result.testName} (${(0, testsUtil_1.calculateTotalTimeSeconds)(result.startTime, result.endTime)}s)`));
|
|
273
|
+
loggingProvider_1.logger.info(chalk.red(` - ${result.testName} (${(0, testsUtil_1.calculateTotalTimeSeconds)(result.startTime, result.endTime)}s) - ${result.testId}`));
|
|
273
274
|
}
|
|
274
275
|
});
|
|
276
|
+
if (parsed.labels || parsed['from-plan-id'] || process.env.CI) {
|
|
277
|
+
loggingProvider_1.logger.info(`Rerun any failed test with the following command template:`);
|
|
278
|
+
loggingProvider_1.logger.info(`${chalk.magenta(generateRunCommandTemplate(parsed, results))}`);
|
|
279
|
+
}
|
|
275
280
|
}
|
|
276
281
|
loggingProvider_1.logger.info(`Total time: ${(0, testsUtil_1.calculateTotalTimeSeconds)(commandStartTime, Date.now())} seconds`);
|
|
277
282
|
if (parsed.reporter) {
|
|
@@ -283,3 +288,23 @@ async function run(parsed) {
|
|
|
283
288
|
return 'done';
|
|
284
289
|
}
|
|
285
290
|
exports.run = run;
|
|
291
|
+
function generateRunCommandTemplate(parsed, testResults) {
|
|
292
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
293
|
+
const testResult = testResults.testResults[0];
|
|
294
|
+
let templateCommand = `${defaultEnv_1.SCRIPT_NAME} ${parsed._.join(' ')} \\\n`;
|
|
295
|
+
if ((_a = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _a === void 0 ? void 0 : _a.environmentId) {
|
|
296
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgEnvironmentId} ${(_b = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _b === void 0 ? void 0 : _b.environmentId} \\\n`;
|
|
297
|
+
}
|
|
298
|
+
if ((_c = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _c === void 0 ? void 0 : _c.credentialsId) {
|
|
299
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgCredentials} ${(_d = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _d === void 0 ? void 0 : _d.credentialsId} \\\n`;
|
|
300
|
+
}
|
|
301
|
+
if ((_e = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _e === void 0 ? void 0 : _e.url) {
|
|
302
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgUrl} ${(_f = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _f === void 0 ? void 0 : _f.url} \\\n`;
|
|
303
|
+
}
|
|
304
|
+
if ((_g = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _g === void 0 ? void 0 : _g.branch) {
|
|
305
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgMablBranch} ${testResult.rerunConfig.branch} \\\n`;
|
|
306
|
+
}
|
|
307
|
+
const testIdVal = parsed.id ? parsed.id : '<TEST-ID>';
|
|
308
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgId} ${testIdVal}`;
|
|
309
|
+
return templateCommand;
|
|
310
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getDefaultLogMetadataForInfo = exports.MablCoreProcessAction = exports.MablCoreAction = exports.ObservationErrorSeverity = exports.ObservationErrorCode = exports.ExecutionPhase = exports.EventChannelMessageType = exports.getEmitter = exports.mablEventEmitter = exports.MablCoreEventEmitter = void 0;
|
|
4
|
+
exports.createAssertFailureMessage = exports.getDefaultLogMetadataForInfo = exports.MablCoreProcessAction = exports.MablCoreAction = exports.ObservationErrorSeverity = exports.ObservationErrorCode = exports.ExecutionPhase = exports.EventChannelMessageType = exports.getEmitter = exports.mablEventEmitter = exports.MablCoreEventEmitter = void 0;
|
|
5
5
|
const events_1 = require("events");
|
|
6
6
|
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
7
|
+
const pureUtil_1 = require("../../util/pureUtil");
|
|
7
8
|
const NO_ID_PLACEHOLDER = 'NO_ID_PROVIDED';
|
|
8
9
|
class MablCoreEventEmitter {
|
|
9
10
|
constructor(debug) {
|
|
@@ -101,3 +102,16 @@ function getDefaultLogMetadataForInfo(testId, testInvariantId) {
|
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
exports.getDefaultLogMetadataForInfo = getDefaultLogMetadataForInfo;
|
|
105
|
+
function createAssertFailureMessage(assertFailure) {
|
|
106
|
+
if (assertFailure) {
|
|
107
|
+
const { reason, expected, found, continueOnFailure } = assertFailure;
|
|
108
|
+
return {
|
|
109
|
+
reason,
|
|
110
|
+
expected: (0, pureUtil_1.stringifyIfPresent)(expected),
|
|
111
|
+
found: (0, pureUtil_1.stringifyIfPresent)(found),
|
|
112
|
+
continueOnFailure,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
exports.createAssertFailureMessage = createAssertFailureMessage;
|