process test file count

pull/5370/head
aniket-engg 5 years ago committed by Aniket
parent 3fffa5d4a3
commit bbf15c2f05
  1. 12
      libs/remix-tests/src/compiler.ts
  2. 4
      libs/remix-tests/src/run.ts

@ -103,19 +103,19 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
}
} else {
// walkSync only if it is a directory
let solFileCount = 0;
let testFileCount = 0;
fs.walkSync(filepath, (foundpath: string) => {
// only process .sol files
if (foundpath.split('.').pop() === 'sol') {
solFileCount++;
if (foundpath.split('.').pop() === 'sol' && foundpath.endsWith('_test.sol')) {
testFileCount++;
processFile(foundpath, sources, true)
}
})
if(solFileCount > 0) {
log.info(`${solFileCount} Solidity files found`)
if(testFileCount > 0) {
log.info(`${testFileCount} Solidity test file${testFileCount===1?'':'s'} found`)
}
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()
}
}

@ -37,10 +37,10 @@ commander.command('help').description('output usage information').action(functio
commander
.option('-v, --verbose <level>', 'run with verbosity', mapVerbosity)
.action(async (testsPath) => {
// Check if path exists
if (!fs.existsSync(testsPath)) {
console.error(testsPath + ' not found')
log.error(testsPath + ' not found')
process.exit(1)
}

Loading…
Cancel
Save