diff --git a/src/cli/commands/test/index.ts b/src/cli/commands/test/index.ts index 8fdfb9e738..32a5e96ef3 100644 --- a/src/cli/commands/test/index.ts +++ b/src/cli/commands/test/index.ts @@ -112,16 +112,12 @@ async function test(...args: MethodArgs): Promise { const ecosystem = getEcosystemForTest(options); if (ecosystem) { - try { - const commandResult = await testEcosystem( - ecosystem, - args as string[], - options, - ); - return commandResult; - } catch (error) { - throw new Error(error); - } + const commandResult = await testEcosystem( + ecosystem, + args as string[], + options, + ); + return commandResult; } // Promise waterfall to test all other paths sequentially diff --git a/src/lib/plugins/code/analysis.ts b/src/lib/plugins/code/analysis.ts index 18f0e0e484..998ca9c4c9 100644 --- a/src/lib/plugins/code/analysis.ts +++ b/src/lib/plugins/code/analysis.ts @@ -11,27 +11,35 @@ export async function getCodeAnalysisAndParseResults( root: string, options: Options, ): Promise { - let currentLabel = '' - await spinner.clearAll() - codeClient.emitter.on('scanFilesProgress', async(processed: number) => { - const spinnerLbl =`Indexed ${processed} files`; + let currentLabel = ''; + await spinner.clearAll(); + codeClient.emitter.on('scanFilesProgress', async (processed: number) => { + const spinnerLbl = `Indexed ${processed} files`; spinner.clear(currentLabel)(); - currentLabel = spinnerLbl + currentLabel = spinnerLbl; await spinner(spinnerLbl); }); - codeClient.emitter.on('uploadBundleProgress', async(processed: number, total: number) => { - const spinnerLbl = `Upload bundle progress: ${processed}/${total}`; + codeClient.emitter.on( + 'uploadBundleProgress', + async (processed: number, total: number) => { + const spinnerLbl = `Upload bundle progress: ${processed}/${total}`; + spinner.clear(currentLabel)(); + currentLabel = spinnerLbl; + await spinner(spinnerLbl); + }, + ); + codeClient.emitter.on('analyseProgress', async (data: any) => { + const spinnerLbl = `Analysis ${data.status}: ${Math.round( + data.progress * 100, + )}%`; spinner.clear(currentLabel)(); - currentLabel = spinnerLbl - await spinner(spinnerLbl); - }); - codeClient.emitter.on('analyseProgress', async(data: any) => { - const spinnerLbl = `Analysis ${data.status}: ${Math.round(data.progress *100)}%`; - spinner.clear(currentLabel)(); - currentLabel = spinnerLbl + currentLabel = spinnerLbl; await spinner(spinnerLbl); }); + codeClient.emitter.on('sendError', (error) => { + throw error; + }); const codeAnalysis = await getCodeAnalysis(root, options); spinner.clearAll(); return parseSecurityResults(codeAnalysis);