salix-front/test.js

317 lines
51 KiB
JavaScript

function parseDuration(str) {
if (str.endsWith('ms')) {
const ms = parseInt(str.replace('ms', ''));
return ms;
}
const [min, sec] = str.split(':').map(Number);
return (min * 60 + sec) * 1000;
}
function formatDuration(ms) {
const totalSeconds = Math.floor(ms / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
const milliseconds = ms % 1000;
return `${minutes}:${seconds.toString().padStart(2, '0')}.${milliseconds.toString().padStart(3, '0')}`;
}
function getModuleDurations(text) {
const lines = text.split('\n');
const moduleTimes = {};
const regex = /✔\s+([\w]+)\/[^\s]+\s+([0-9]+:[0-9]{2}|[0-9]+ms)/;
for (const line of lines) {
const match = regex.exec(line);
if (match) {
const module = match[1];
const duration = parseDuration(match[2]);
if (!moduleTimes[module]) moduleTimes[module] = 0;
moduleTimes[module] += duration;
}
}
const sorted = Object.entries(moduleTimes)
.sort((a, b) => b[1] - a[1])
.map(([module, time]) => ({
module,
totalDuration: formatDuration(time),
}));
return sorted;
}
// Ejemplo de uso (reemplaza con tu texto real)
const result = getModuleDurations(`
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ Order/orderCatalog.spec.js 00:15 6 5 - 1 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ Supplier/SupplierBalance.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ account/accountDescriptorMenu.spec. 00:04 2 2 - - - │
│ js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ claim/claimAction.spec.js 197ms 5 - - 5 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ claim/claimDevelopment.spec.js 170ms 3 - - 3 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ claim/claimNotes.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ claim/claimPhoto.spec.js 178ms 4 - - 4 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientAddress.spec.js 00:06 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientBalance.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientBasicData.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientBillingData.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientCredits.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientFiscalData.spec.js 00:05 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientGreuges.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientList.spec.js 169ms 4 - - 4 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientNotes.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientRecoveries.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientSms.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/clientWebAccess.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entryList.spec.js 00:08 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entryStockBought.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entrySupplier.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entryWasteRecalc.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceIn/invoiceInBasicData.spec.j 00:08 2 2 - - - │
│ s │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceIn/invoiceInCorrective.spec. 00:10 3 3 - - - │
│ js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceIn/invoiceInDescriptor.spec. 00:24 12 11 - 1 - │
│ js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceIn/invoiceInDueDay.spec.js 00:06 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceIn/invoiceInIntrastat.spec.j 00:08 3 3 - - - │
│ s │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceIn/invoiceInList.spec.js 00:09 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceIn/invoiceInSerial.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceIn/invoiceInSummary.spec.js 00:05 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceIn/invoiceInVat.spec.js 00:13 5 5 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceOut/invoiceOutList.spec.js 00:17 7 7 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceOut/invoiceOutMakeInvoice.sp 210ms 1 - - 1 - │
│ ec.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceOut/invoiceOutNegativeBases. 00:03 2 1 - 1 - │
│ spec.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceOut/invoiceOutSummary.spec.j 00:24 9 9 - - - │
│ s │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ invoiceOut/invvoiceOutGlobal.spec.j 00:04 1 1 - - - │
│ s │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ item/ItemFixedPrice.spec.js 168ms 4 - - 4 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ item/ItemProposal.spec.js 1ms - - - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ item/itemBarcodes.spec.js 00:05 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ item/itemBotanical.spec.js 00:07 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ item/itemList.spec.js 168ms 2 - - 2 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ item/itemSummary.spec.js 00:05 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ item/itemTag.spec.js 00:06 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ item/itemTax.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ item/itemType.spec.js 00:07 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ outLogin/login.spec.js 00:08 5 5 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ outLogin/logout.spec.js 197ms 2 - - 2 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ outLogin/recoverPassword.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ outLogin/twoFactor.spec.js 00:04 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ order/orderList.spec.js 00:08 3 2 - 1 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ route/routeAutonomous.spec.js 236ms 9 - - 9 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ route/routeExtendedList.spec.js 00:39 11 11 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ route/routeList.spec.js 00:25 11 11 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ shelving/shelvingBasicData.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ shelving/shelvingList.spec.js 00:09 4 4 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/ticketBoxing.spec.js 00:05 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/ticketDescriptor.spec.js 00:05 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/ticketExpedition.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/ticketFilter.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/ticketList.spec.js 00:19 6 6 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/ticketNotes.spec.js 00:04 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/ticketRequest.spec.js 00:04 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/ticketSale.spec.js 00:40 14 14 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ vnComponent/UserPanel.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ vnComponent/VnAccountNumber.spec.js 00:08 4 4 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ vnComponent/VnBreadcrumbs.spec.js 00:03 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ vnComponent/VnLocation.spec.js 00:30 12 12 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ vnComponent/VnLog.spec.js 00:06 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ vnComponent/VnSearchBar.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ vnComponent/VnShortcut.spec.js 00:17 11 11 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ wagon/wagonCreate.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerBasicData.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerBusiness.spec.js 186ms 1 - - 1 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerCreate.spec.js 00:15 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerList.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerLocker.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerMutual.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerNotes.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerNotificationsManager.s 00:07 4 4 - - - │
│ pec.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerOperator.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerPda.spec.js 00:10 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerPit.spec.js 00:04 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ worker/workerSummary.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ zone/zoneBasicData.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ zone/zoneCalendar.spec.js 00:12 4 4 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ zone/zoneCreate.spec.js 00:06 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ zone/zoneDeliveryDays.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ zone/zoneList.spec.js 00:05 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ zone/zoneLocations.spec.js 00:04 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ zone/zoneSummary.spec.js 00:03 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ zone/zoneUpcomingDeliveries.spec.js 00:01 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ zone/zoneWarehouse.spec.js 00:03 2 1 - 1 - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/credit-management/clientCred 00:02 1 1 - - - │
│ itContracts.spec.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/credit-management/clientCred 00:02 1 1 - - - │
│ itOpinion.spec.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/others/clientConsumption.spe 00:02 1 1 - - - │
│ c.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/others/clientContacts.spec.j 00:02 1 1 - - - │
│ s │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/others/clientMandates.spec.j 00:02 1 1 - - - │
│ s │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/others/clientSamples.spec.js 00:02 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/others/clientUnpaid.spec.js 00:04 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ client/others/clientWebPayments.spe 00:02 1 1 - - - │
│ c.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entryCard/entryBasicData.spec 00:05 1 1 - - - │
│ .js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entryCard/entryBuys.spec.js 00:09 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entryCard/entryDescriptor.spe 00:05 1 1 - - - │
│ c.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entryCard/entryDms.spec.js 00:05 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entryCard/entryLock.spec.js 00:07 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ entry/entryCard/entryNotes.spec.js 00:08 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ route/cmr/cmrList.spec.js 00:18 6 6 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ route/agency/agencyWorkCenter.spec. 00:03 1 1 - - - │
│ js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ route/roadMap/roadmapList.spec.js 00:10 5 5 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ route/vehicle/vehicleDescriptor.spe 00:02 1 1 - - - │
│ c.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ route/vehicle/vehicleList.spec.js 00:09 4 4 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ shelving/parking/parkingBasicData.s 00:05 2 2 - - - │
│ pec.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ shelving/parking/parkingList.spec.j 00:06 3 3 - - - │
│ s │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/negative/TicketLackDetail.sp 179ms 2 - - 2 - │
│ ec.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ ticket/negative/TicketLackList.spec 00:03 1 1 - - - │
│ .js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ wagon/wagonType/wagonTypeCreate.spe 00:03 1 1 - - - │
│ c.js │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ wagon/wagonType/wagonTypeEdit.spec. 00:05 3 3 - - - │
│ js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! 12:49 317 275 - 42 -
`);
console.table(result);