diff --git a/packages/e2e-test/src/commands/run.ts b/packages/e2e-test/src/commands/run.ts index 905cb20d52..be00b99e54 100644 --- a/packages/e2e-test/src/commands/run.ts +++ b/packages/e2e-test/src/commands/run.ts @@ -84,11 +84,23 @@ async function buildDistWorkspace(workspaceName: string, rootDir: string) { const path = paths.resolveOwnRoot(pkgJsonPath); const pkgTemplate = await fs.readFile(path, 'utf8'); const { dependencies = {}, devDependencies = {} } = JSON.parse( - handlebars.compile(pkgTemplate)({ - version: '0.0.0', - privatePackage: true, - scopeName: '@backstage', - }), + handlebars.compile(pkgTemplate)( + { + privatePackage: true, + scopeName: '@backstage', + }, + { + helpers: { + version(name: string) { + const pkg = require(`${name}/package.json`); + if (!pkg) { + throw new Error(`No version available for package ${name}`); + } + return pkg.version; + }, + }, + }, + ), ); Array()