diff --git a/examples/workflow-test/configs/utils.ts b/examples/workflow-test/configs/utils.ts index 62cad5a..8f05d01 100644 --- a/examples/workflow-test/configs/utils.ts +++ b/examples/workflow-test/configs/utils.ts @@ -45,6 +45,16 @@ export function getRepoPath(repoName: string): string { return path.resolve(getRepoDir(), repoName); } +// TEMPORARY: remove once all GLSP repos are migrated to pnpm. +// During the migration a cloned integration repo may still be yarn-based. The package manager +// determines how a binary is launched in a sub-package: pnpm's script shorthand only runs +// package.json scripts, so the `theia` binary must be invoked via `pnpm exec`, whereas yarn classic +// runs binaries directly and has no `exec` command. Detect the lockfile so callers can adapt. +// Mirrors the yarn.lock-based detection in scripts/setup.ts. +export function isYarnRepo(repoName: string): boolean { + return existsSync(path.resolve(getRepoPath(repoName), 'yarn.lock')); +} + export function getPort(envVar: string): number { const val = process.env[envVar]; if (val) { diff --git a/examples/workflow-test/configs/webserver.config.ts b/examples/workflow-test/configs/webserver.config.ts index 9152265..97d85a6 100644 --- a/examples/workflow-test/configs/webserver.config.ts +++ b/examples/workflow-test/configs/webserver.config.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { PlaywrightTestConfig } from '@playwright/test'; -import { ProjectName, getBrowserServerBundlePath, getPort, getRepoDir, needsGlspServer } from './utils'; +import { ProjectName, getBrowserServerBundlePath, getPort, getRepoDir, isYarnRepo, needsGlspServer } from './utils'; type WebServerConfig = Extract, unknown[]>[number]; @@ -41,6 +41,7 @@ export function buildWebServers(activeProjects: ProjectName[]): PlaywrightTestCo const standaloneBrowserPort = getPort('STANDALONE_BROWSER_PORT'); const theiaPort = getPort('THEIA_PORT'); const browserServerBundle = getBrowserServerBundlePath(); + const theiaBin = isYarnRepo('glsp-theia-integration') ? 'theia' : 'exec theia'; const configs: Partial> = { standalone: { command: `${repo} client start --external-server --no-open`, @@ -55,7 +56,12 @@ export function buildWebServers(activeProjects: ProjectName[]): PlaywrightTestCo path: '/diagram.html' }, theia: { - command: `${repo} theia run browser theia start --WF_GLSP=${glspServerPort} --WF_PATH=workflow --glspDebug`, + // TEMPORARY: drop the `isYarnRepo` branch once glsp-theia-integration is migrated to pnpm. + // The command resolves to ` browser theia start ...` in the cloned repo. Under + // pnpm the `theia` binary must be launched via `pnpm exec` (the script shorthand only runs + // package.json scripts, else it fails with ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL); yarn classic + // runs binaries directly and has no `exec` command. + command: `${repo} theia run browser ${theiaBin} start --WF_GLSP=${glspServerPort} --WF_PATH=workflow --glspDebug`, port: theiaPort } };