Skip to content

Commit 6d4e7a3

Browse files
committed
update logs for unit tests errors
1 parent b6a5565 commit 6d4e7a3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/helpers/unitTests.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ let functionList = {},
2727
queriedPath = '',
2828
folderStructureTree = [],
2929
testsGenerated = [],
30+
errors = [],
3031
ignoreFolders = ['node_modules', 'pythagora_tests']
3132
;
3233

@@ -158,6 +159,7 @@ async function createTests(filePath, prefix, funcToTest) {
158159
}
159160

160161
} catch (e) {
162+
errors.push(e);
161163
// writeLine(`Error parsing file ${filePath}: ${e}`);
162164
}
163165
}
@@ -235,8 +237,9 @@ async function generateTestsForDirectory(pathToProcess, funcName) {
235237

236238
screen.destroy();
237239
process.stdout.write('\x1B[2J\x1B[0f');
240+
if (errors.length) console.log('Errors encountered while trying to generate unit tests:\n', errors);
238241
if (testsGenerated.length === 0) {
239-
console.log(`${bold+red}No tests generated${funcName ? ' - can\'t find a function named "' + funcName + '"' : ''}!${reset}`);
242+
console.log(`${bold+red}No tests generated!${reset}`);
240243
} else {
241244
console.log(`Tests are saved in the following directories:${testsGenerated.reduce((acc, item) => acc + '\n' + blue + item, '')}`);
242245
console.log(`${bold+green}${testsGenerated.length} unit tests generated!${reset}`);

0 commit comments

Comments
 (0)