UNPKG

e2ed

Version:

E2E testing framework over Playwright

28 lines (27 loc) 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.afterRetries = void 0; const configurator_1 = require("../../configurator"); const config_1 = require("../config"); const generalLog_1 = require("../generalLog"); const getDurationWithUnits_1 = require("../getDurationWithUnits"); const getPrintedTestsCount_1 = require("./getPrintedTestsCount"); /** * After docker retries handler. * @internal */ const afterRetries = (retriesState) => { const { maxRetriesCountInDocker } = (0, config_1.getFullPackConfig)(); const { failedTestNamesInLastRetry, successfulTestRunNamesHash } = retriesState; const durationWithUnits = (0, getDurationWithUnits_1.getDurationWithUnits)(Date.now() - configurator_1.startTimeInMs); const durationString = `in ${durationWithUnits}`; const retryString = `${maxRetriesCountInDocker} ${maxRetriesCountInDocker === 1 ? 'retry' : 'retries'}`; const isLastRetrySuccessful = failedTestNamesInLastRetry.length === 0; if (isLastRetrySuccessful) { (0, generalLog_1.generalLog)(`All ${(0, getPrintedTestsCount_1.getPrintedTestsCount)(Object.keys(successfulTestRunNamesHash).length)} completed successfully with ${retryString} ${durationString}`); } else { (0, generalLog_1.generalLog)(`There are ${(0, getPrintedTestsCount_1.getPrintedTestsCount)(failedTestNamesInLastRetry.length, true)} after ${retryString} ${durationString}`, { failedTestNamesInLastRetry }); } }; exports.afterRetries = afterRetries;