Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions examples/workflow-test/configs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 8 additions & 2 deletions examples/workflow-test/configs/webserver.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<NonNullable<PlaywrightTestConfig['webServer']>, unknown[]>[number];

Expand All @@ -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<Record<ProjectName, ProjectServerConfig>> = {
standalone: {
command: `${repo} client start --external-server --no-open`,
Expand All @@ -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 `<pm> browser <exec?> 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
}
};
Expand Down