mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-07 22:18:33 +00:00
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:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user