Skip to content

Commit b04a24d

Browse files
committed
Merge branch 'main' into feat/expand-unit-tests
2 parents 4af9032 + 3369b1a commit b04a24d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pythagora",
3-
"version": "0.0.76",
3+
"version": "0.0.78",
44
"author": {
55
"name": "Zvonimir Sabljic",
66
"email": "[email protected]"

src/bin/run.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ do
6060
exit 0
6161
elif [[ "${args[$i]}" == "--unit-tests" ]]
6262
then
63-
echo "${green}${bold}Generating unit tests...${reset}"
63+
echo "${green}${bold}Starting generation of unit tests...${reset}"
6464
PYTHAGORA_CONFIG="$@" node "${pythagora_dir}/src/scripts/unit.js"
6565
exit 0
6666

src/helpers/unitTests.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async function processFile(filePath, filesToProcess) {
6969
if (importedFile && !filesToProcess.includes(importedFile)) {
7070
filesToProcess.push(importedFile);
7171
}
72-
} else if (node.type === "VariableDeclaration" && node.declarations[0].init.type === "CallExpression" && node.declarations[0].init.callee.name === "require") {
72+
} else if (node.type === "VariableDeclaration" && node.declarations.length > 0 && node.declarations[0].init && node.declarations[0].init.type === "CallExpression" && node.declarations[0].init.callee.name === "require") {
7373
let importedFile = path.resolve(path.dirname(filePath), node.declarations[0].init.arguments[0].value);
7474
importedFile = resolveFilePath(importedFile, extension);
7575
if (importedFile && !filesToProcess.includes(importedFile)) {
@@ -395,12 +395,14 @@ async function generateTestsForDirectory(args, processingFunction = 'getUnitTest
395395
API.checkForAPIKey();
396396
queriedPath = path.resolve(pathToProcess);
397397
rootPath = args.pythagora_root;
398-
({ screen, spinner, scrollableContent } = initScreenForUnitTests());
398+
console.log('Processing folder structure...');
399399

400400
await traverseDirectory(queriedPath, true, funcName, processingFunction);
401401
processedFiles = [];
402402
await traverseDirectory(queriedPath, true, funcName, processingFunction);
403403
processedFiles = [];
404+
console.log('Generating tests...');
405+
({ screen, spinner, scrollableContent } = initScreenForUnitTests());
404406
await traverseDirectory(queriedPath, false, funcName, processingFunction);
405407

406408
screen.destroy();

0 commit comments

Comments
 (0)