Skip to content

Commit 164e59b

Browse files
committed
Merge branch 'feat/expand-unit-tests' of https://github.com/Pythagora-io/pythagora into feat/expand-unit-tests
2 parents b04a24d + addf9fc commit 164e59b

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

src/helpers/unitTests.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -352,30 +352,6 @@ function sortFolderTree() {
352352
}
353353
}
354354

355-
function sortFolderTree() {
356-
// 1. Sort the folderStructureTree
357-
folderStructureTree.sort((a, b) => {
358-
if (a.absolutePath < b.absolutePath) {
359-
return -1;
360-
}
361-
if (a.absolutePath > b.absolutePath) {
362-
return 1;
363-
}
364-
return 0;
365-
});
366-
367-
// 2. Set prefix according to the position in the directory
368-
for (let i = 0; i < folderStructureTree.length; i++) {
369-
// Get the current directory path
370-
const currentDirPath = path.dirname(folderStructureTree[i].absolutePath);
371-
// Check if it's the last file in the directory
372-
if (i === folderStructureTree.length - 1 || path.dirname(folderStructureTree[i + 1].absolutePath) !== currentDirPath) {
373-
// Update the prefix for the last file in the directory
374-
folderStructureTree[i].line = folderStructureTree[i].line.replace("├───", "└───");
375-
}
376-
}
377-
}
378-
379355
async function getFunctionsForExport(dirPath, ignoreFilesRewrite) {
380356
if (ignoreFilesRewrite) {
381357
isFileToIgnore = ignoreFilesRewrite;

src/helpers/unitTestsExpand.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ async function createAdditionalTests(filePath, prefix) {
144144
].line = `${red}${folderStructureTree[fileIndex].line}${reset}`;
145145
}
146146
} catch (e) {
147-
if (!ignoreErrors.includes(e.code)) errors.push(e);
147+
if (!ignoreErrors.includes(e.code)) errors.push(e.stack);
148148
}
149149
}
150150

@@ -196,7 +196,7 @@ async function expandTestsForDirectory(args) {
196196
checkForAPIKey();
197197
queriedPath = path.resolve(pathToProcess);
198198
rootPath = process.cwd();
199-
({ screen, spinner, scrollableContent } = initScreenForUnitTests());
199+
console.log("Processing folder structure...");
200200

201201
const exportData = await getFunctionsForExport(
202202
pathToProcess || rootPath,
@@ -210,6 +210,8 @@ async function expandTestsForDirectory(args) {
210210
(i) => checkForTestFilePath(i.absolutePath) || i.isDirectory
211211
);
212212

213+
({ screen, spinner, scrollableContent } = initScreenForUnitTests());
214+
213215
await traverseDirectoryTests(queriedPath, false);
214216

215217
screen.destroy();

0 commit comments

Comments
 (0)