diff --git a/packages/etherlime/cli-commands/compiler/compiler.js b/packages/etherlime/cli-commands/compiler/compiler.js index f6abfc1b5..8b7ae1926 100644 --- a/packages/etherlime/cli-commands/compiler/compiler.js +++ b/packages/etherlime/cli-commands/compiler/compiler.js @@ -84,13 +84,7 @@ const compilePromise = async (compileOptions, quiet) => { resolve(); } catch (error) { - let stack = error['stack'].split(',/'); - - stack.forEach(message => { - logger.log(message); - }); - - return reject(stack); + return reject(error); } }); }; diff --git a/packages/etherlime/cli-commands/compiler/etherlime-contract-sources/index.js b/packages/etherlime/cli-commands/compiler/etherlime-contract-sources/index.js index 514c0c881..edb8a57e0 100644 --- a/packages/etherlime/cli-commands/compiler/etherlime-contract-sources/index.js +++ b/packages/etherlime/cli-commands/compiler/etherlime-contract-sources/index.js @@ -19,6 +19,8 @@ let find_contracts = async (workingPath) => { } try { + + const readFiles = await readAllFilesSync(workingPath); return resolve(fetchSolAndVyperFiles(readFiles)) } catch (err) { @@ -28,29 +30,31 @@ let find_contracts = async (workingPath) => { }); } -const readAllFilesSync = async function(dir, fileList) { +const readAllFilesSync = async function (dir, fileList) { files = await fs.readdirSync(dir); fileList = fileList || []; - for(let i = 0; i < files.length; i++) { - const filePath = path.join(dir, files[i]) + for (const file of files) { + const filePath = path.join(dir, file) if (fs.statSync(filePath).isDirectory()) { - fileList = await readAllFilesSync(filePath, fileList); + fileList = await readAllFilesSync(filePath, fileList); } else { - fileList.push(filePath); + fileList.push(filePath); } } return fileList; }; const fetchSolAndVyperFiles = (files) => { + let solFiles = []; let vyperFiles = []; - files.forEach(file => { + for (const file of files) { if (path.extname(file) == SOL_EXTENSION && path.basename(file)[0] != '.') solFiles.push(file) if (path.extname(file) == VYPER_EXTENSION && path.basename(file)[0] != '.') vyperFiles.push(file) - }) + } + return { solFiles, vyperFiles } } diff --git a/test/etherlime/cli-commands/commands/commands.js b/test/etherlime/cli-commands/commands/commands.js index 1fa72bcae..ccdc982ad 100644 --- a/test/etherlime/cli-commands/commands/commands.js +++ b/test/etherlime/cli-commands/commands/commands.js @@ -36,7 +36,7 @@ describe('root calling cli commands', () => { it('should throw err if compile cli command failed', async function () { let expectedOutput = "ENOENT: no such file or directory" let childProcess = await runCmdHandler(`etherlime compile`, expectedOutput); - assert.include(childProcess.output, expectedOutput) + assert.include(childProcess, expectedOutput) }); it('should throw err if test cli command failed', async function () { @@ -54,7 +54,7 @@ describe('root calling cli commands', () => { it('should throw err if deploy failed', async function () { let expectedOutput = "ENOENT: no such file or directory" let childProcess = await runCmdHandler(`etherlime deploy`, expectedOutput); - assert.include(childProcess.output, expectedOutput) + assert.include(childProcess, expectedOutput) }); it('should throw err if ganache failed', async function () {