@mablhq/mabl-cli 1.26.5 → 1.29.0
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/api/entities/Browser.js +1 -0
- package/api/mablApiClient.js +14 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +20 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/simplePlaywrightLogger.js +36 -0
- package/cli.js +1 -0
- package/commands/browserTypes.js +19 -8
- package/commands/constants.js +9 -7
- package/commands/tests/testsUtil.js +45 -43
- package/commands/tests/tests_cmds/run-cloud.js +2 -2
- package/commands/tests/tests_cmds/run.js +24 -1
- package/commands/users/users.js +5 -0
- package/commands/users/users_cmds/list.js +58 -0
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/package.json +3 -3
- package/resources/mablFind.js +1 -1
- package/util/asyncUtil.js +9 -5
package/util/asyncUtil.js
CHANGED
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.filterAsync = exports.mapAsync = exports.TimeoutError = exports.promiseWithTimeout = void 0;
|
|
4
4
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
5
|
-
async function promiseWithTimeout(promise, timeoutMillis, description, timeoutType = 'mabl promise timeout') {
|
|
5
|
+
async function promiseWithTimeout(promise, timeoutMillis, description, timeoutType = 'mabl promise timeout', printToConsole = true) {
|
|
6
6
|
const startTimeMillis = new Date().getTime();
|
|
7
|
-
const { timer, cancelTimer } = startTimer(timeoutMillis, description, timeoutType);
|
|
7
|
+
const { timer, cancelTimer, errorMessage } = startTimer(timeoutMillis, description, timeoutType);
|
|
8
8
|
try {
|
|
9
9
|
const result = await Promise.race([timer, promise]);
|
|
10
|
-
if (loggingProvider_1.logger.isDebugEnabled()) {
|
|
10
|
+
if (loggingProvider_1.logger.isDebugEnabled() && printToConsole) {
|
|
11
11
|
loggingProvider_1.logger.debug(`"${description}" completed in ${new Date().getTime() - startTimeMillis}ms`);
|
|
12
12
|
}
|
|
13
13
|
return result;
|
|
14
14
|
}
|
|
15
15
|
catch (error) {
|
|
16
|
-
if (error instanceof TimeoutError
|
|
16
|
+
if (error instanceof TimeoutError &&
|
|
17
|
+
printToConsole &&
|
|
18
|
+
error.message === errorMessage) {
|
|
17
19
|
loggingProvider_1.logger.warn(error.message);
|
|
18
20
|
}
|
|
19
21
|
throw error;
|
|
@@ -35,13 +37,15 @@ class TimeoutError extends Error {
|
|
|
35
37
|
exports.TimeoutError = TimeoutError;
|
|
36
38
|
const startTimer = (timeoutMillis, description, timeoutType) => {
|
|
37
39
|
let timeout;
|
|
40
|
+
const timeoutError = new TimeoutError(timeoutMillis, description, timeoutType);
|
|
38
41
|
const promise = new Promise((_resolve, reject) => {
|
|
39
|
-
timeout = global.setTimeout(() => reject(
|
|
42
|
+
timeout = global.setTimeout(() => reject(timeoutError), timeoutMillis);
|
|
40
43
|
timeout.unref();
|
|
41
44
|
});
|
|
42
45
|
return {
|
|
43
46
|
timer: promise,
|
|
44
47
|
cancelTimer: () => global.clearTimeout(timeout),
|
|
48
|
+
errorMessage: timeoutError.message,
|
|
45
49
|
};
|
|
46
50
|
};
|
|
47
51
|
function mapAsync(array, callback) {
|