From f71f6f258c94e22a66f77d80b083e853f69c8f1c Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 5 Feb 2026 13:59:24 +0100 Subject: [PATCH 1/2] fix: resolve e2e test failures for community plugin build The e2e tests were failing due to three issues: - isolated-vm native module build failures during yarn install - Running yarn install from plugin directory instead of workspace root - Missing TypeScript declaration files required for plugin builds This fix: - Uses YARN_ENABLE_SCRIPTS=false to skip native module builds - Installs dependencies from workspace root (workspaces/tech-radar) - Runs yarn tsc at workspace level before building individual plugins - Improves error logging to show detailed failure information Assisted-by: Claude Code Signed-off-by: Tomas Kral --- .../community-plugin-build-package.test.ts | 62 ++++++++++++------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/e2e-tests/community-plugin-build-package.test.ts b/e2e-tests/community-plugin-build-package.test.ts index c5490d6..c55d7e1 100644 --- a/e2e-tests/community-plugin-build-package.test.ts +++ b/e2e-tests/community-plugin-build-package.test.ts @@ -35,19 +35,29 @@ async function runCommand( `Executing command: ${command}, in directory: ${options.cwd || process.cwd()}`, ); - const { err, stdout, stderr } = await exec(command, { - shell: true, - ...options, - }); - console.log(`Command output: ${stdout}`); - console.log(`Command error output: ${stderr}`); - if (err) { - console.error(`Error executing command: ${command}`); - console.error(stderr); - console.error(stdout); - throw err; + try { + const { stdout, stderr } = await exec(command, { + shell: true, + maxBuffer: 10 * 1024 * 1024, // 10MB buffer for large outputs + ...options, + }); + console.log(`Command output: ${stdout}`); + if (stderr) { + console.log(`Command stderr: ${stderr}`); + } + return { stdout, stderr }; + } catch (error: any) { + console.error(`\n========== COMMAND FAILED ==========`); + console.error(`Command: ${command}`); + console.error(`Working directory: ${options.cwd || process.cwd()}`); + console.error(`Exit code: ${error.code}`); + console.error(`Signal: ${error.signal}`); + console.error(`\n--- STDOUT ---\n${error.stdout || '(empty)'}`); + console.error(`\n--- STDERR ---\n${error.stderr || '(empty)'}`); + console.error(`\n--- ERROR MESSAGE ---\n${error.message}`); + console.error(`====================================\n`); + throw error; } - return { stdout, stderr }; } async function parseDynamicPluginAnnotation( @@ -136,23 +146,33 @@ describe('export and package backstage-community plugin', () => { describe.each([ [ - 'workspaces/tech-radar/plugins/tech-radar', + 'workspaces/tech-radar', + 'plugins/tech-radar', `rhdh-test-tech-radar-frontend:${Date.now()}`, ], [ - 'workspaces/tech-radar/plugins/tech-radar-backend', + 'workspaces/tech-radar', + 'plugins/tech-radar-backend', `rhdh-test-tech-radar-backend:${Date.now()}`, ], - ])('plugin in %s directory', (pluginPath, imageTag) => { - const getFullPluginPath = () => path.join(getClonedRepoPath(), pluginPath); + ])('plugin in %s/%s directory', (workspacePath, pluginRelPath, imageTag) => { + const getWorkspacePath = () => path.join(getClonedRepoPath(), workspacePath); + const getFullPluginPath = () => + path.join(getClonedRepoPath(), workspacePath, pluginRelPath); beforeAll(async () => { - console.log(`Installing dependencies in ${getFullPluginPath()}`); - await runCommand(`yarn install`, { - cwd: getFullPluginPath(), + console.log(`Installing dependencies in workspace ${getWorkspacePath()}`); + // Use YARN_ENABLE_SCRIPTS=false to skip native module builds that may fail + // Then run tsc and build separately + await runCommand(`YARN_ENABLE_SCRIPTS=false yarn install`, { + cwd: getWorkspacePath(), + }); + console.log(`Generating TypeScript declarations in ${getWorkspacePath()}`); + await runCommand(`yarn tsc`, { + cwd: getWorkspacePath(), }); - console.log(`Compiling TypeScript in ${getFullPluginPath()}`); - await runCommand(`npx tsc`, { + console.log(`Building plugin in ${getFullPluginPath()}`); + await runCommand(`yarn build`, { cwd: getFullPluginPath(), }); }); From 7f40d56128e9ec054a15a13a365a97aab1f8900c Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 5 Feb 2026 14:44:23 +0100 Subject: [PATCH 2/2] fix formatting --- e2e-tests/community-plugin-build-package.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/e2e-tests/community-plugin-build-package.test.ts b/e2e-tests/community-plugin-build-package.test.ts index c55d7e1..fc455bc 100644 --- a/e2e-tests/community-plugin-build-package.test.ts +++ b/e2e-tests/community-plugin-build-package.test.ts @@ -156,7 +156,8 @@ describe('export and package backstage-community plugin', () => { `rhdh-test-tech-radar-backend:${Date.now()}`, ], ])('plugin in %s/%s directory', (workspacePath, pluginRelPath, imageTag) => { - const getWorkspacePath = () => path.join(getClonedRepoPath(), workspacePath); + const getWorkspacePath = () => + path.join(getClonedRepoPath(), workspacePath); const getFullPluginPath = () => path.join(getClonedRepoPath(), workspacePath, pluginRelPath); @@ -167,7 +168,9 @@ describe('export and package backstage-community plugin', () => { await runCommand(`YARN_ENABLE_SCRIPTS=false yarn install`, { cwd: getWorkspacePath(), }); - console.log(`Generating TypeScript declarations in ${getWorkspacePath()}`); + console.log( + `Generating TypeScript declarations in ${getWorkspacePath()}`, + ); await runCommand(`yarn tsc`, { cwd: getWorkspacePath(), });