feat(cli): Refactor request runner and improve folder sorting

~ remove duplicate code by consolidating request collection functionality
~ add proper sorting of folder and request items based on sequence numbers
~ add error request count to run summary output
~ update dev dependencies with proper markings in package-lock.json and removed previously added currently reverted entries
This commit is contained in:
lohit
2025-05-03 23:50:12 +05:30
parent 526fcabffe
commit 520567793a
5 changed files with 110 additions and 203 deletions

View File

@@ -200,10 +200,33 @@ const getTreePathFromCollectionToItem = (collection, _item) => {
return path;
};
const getAllRequestsInFolder = (folderItems = [], recursive = true) => {
let requests = [];
if (folderItems && folderItems.length) {
folderItems.forEach((item) => {
if (item.type !== 'folder') {
requests.push(item);
} else {
if (recursive) {
requests = requests.concat(getAllRequestsInFolder(item.items, recursive));
}
}
});
}
return requests;
};
const getAllRequestsAtFolderRoot = (folderItems = []) => {
return getAllRequestsInFolder(folderItems, false);
};
module.exports = {
mergeHeaders,
mergeVars,
mergeScripts,
findItemInCollection,
getTreePathFromCollectionToItem
getTreePathFromCollectionToItem,
getAllRequestsInFolder,
getAllRequestsAtFolderRoot
}