From d77cedd2ca46770a9ee65e32aa83faee8a9ca122 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 4 Apr 2022 14:50:07 +0200 Subject: [PATCH] e2e-test: pass through errors Signed-off-by: Patrik Oldsberg --- packages/e2e-test/src/commands/run.ts | 61 +++++++++++---------------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/packages/e2e-test/src/commands/run.ts b/packages/e2e-test/src/commands/run.ts index 1ec9499b92..83e0bc78e9 100644 --- a/packages/e2e-test/src/commands/run.ts +++ b/packages/e2e-test/src/commands/run.ts @@ -43,50 +43,39 @@ const templatePackagePaths = [ ]; export async function run() { - try { - const rootDir = await fs.mkdtemp( - resolvePath(os.tmpdir(), 'backstage-e2e-'), - ); - print(`CLI E2E test root: ${rootDir}\n`); + const rootDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-')); + print(`CLI E2E test root: ${rootDir}\n`); - print('Building dist workspace'); - const workspaceDir = await buildDistWorkspace('workspace', rootDir); + print('Building dist workspace'); + const workspaceDir = await buildDistWorkspace('workspace', rootDir); - const isPostgres = Boolean(process.env.POSTGRES_USER); - print('Creating a Backstage App'); - const appDir = await createApp( - 'test-app', - isPostgres, - workspaceDir, - rootDir, - ); + const isPostgres = Boolean(process.env.POSTGRES_USER); + print('Creating a Backstage App'); + const appDir = await createApp('test-app', isPostgres, workspaceDir, rootDir); - print('Creating a Backstage Plugin'); - const pluginName = await createPlugin('test-plugin', appDir); + print('Creating a Backstage Plugin'); + const pluginName = await createPlugin('test-plugin', appDir); - print('Creating a Backstage Backend Plugin'); - await createPlugin('test-plugin', appDir, ['--backend']); + print('Creating a Backstage Backend Plugin'); + await createPlugin('test-plugin', appDir, ['--backend']); - print('Starting the app'); - await testAppServe(pluginName, appDir); + print('Starting the app'); + await testAppServe(pluginName, appDir); - print('Testing the backend startup'); - await testBackendStart(appDir, isPostgres); + print('Testing the backend startup'); + await testBackendStart(appDir, isPostgres); - if (process.env.CI) { - // Cleanup actually takes significant time, so skip it in CI since the - // runner will be destroyed anyway - print('All tests successful'); - } else { - print('All tests successful, removing test dir'); - await fs.remove(rootDir); - } - - // Just in case some child process was left hanging - process.exit(0); - } catch { - process.exit(1); + if (process.env.CI) { + // Cleanup actually takes significant time, so skip it in CI since the + // runner will be destroyed anyway + print('All tests successful'); + } else { + print('All tests successful, removing test dir'); + await fs.remove(rootDir); } + + // Just in case some child process was left hanging + process.exit(0); } /**