Commit cc8ad2c3 authored by aniket-engg's avatar aniket-engg Committed by Aniket

process test file count

parent 85804ad1
...@@ -103,19 +103,19 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: ...@@ -103,19 +103,19 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
} }
} else { } else {
// walkSync only if it is a directory // walkSync only if it is a directory
let solFileCount = 0; let testFileCount = 0;
fs.walkSync(filepath, (foundpath: string) => { fs.walkSync(filepath, (foundpath: string) => {
// only process .sol files // only process .sol files
if (foundpath.split('.').pop() === 'sol') { if (foundpath.split('.').pop() === 'sol' && foundpath.endsWith('_test.sol')) {
solFileCount++; testFileCount++;
processFile(foundpath, sources, true) processFile(foundpath, sources, true)
} }
}) })
if(solFileCount > 0) { if(testFileCount > 0) {
log.info(`${solFileCount} Solidity files found`) log.info(`${testFileCount} Solidity test file${testFileCount===1?'':'s'} found`)
} }
else { else {
log.error(`No Solidity files found`) log.error(`No Solidity test file found. Make sure your test file ends with '_test.sol'`)
process.exit() process.exit()
} }
} }
......
...@@ -37,10 +37,10 @@ commander.command('help').description('output usage information').action(functio ...@@ -37,10 +37,10 @@ commander.command('help').description('output usage information').action(functio
commander commander
.option('-v, --verbose <level>', 'run with verbosity', mapVerbosity) .option('-v, --verbose <level>', 'run with verbosity', mapVerbosity)
.action(async (testsPath) => { .action(async (testsPath) => {
// Check if path exists // Check if path exists
if (!fs.existsSync(testsPath)) { if (!fs.existsSync(testsPath)) {
console.error(testsPath + ' not found') log.error(testsPath + ' not found')
process.exit(1) process.exit(1)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment