From 015911aa1fd664584483135da9e4c21ddb7e10ad Mon Sep 17 00:00:00 2001 From: 4gray Date: Tue, 29 Sep 2026 20:50:11 +0200 Subject: [PATCH] fix(e2e): run electron-backend-e2e targets without nested pnpm exec Under `pnpm nx`, the outer pnpm switches to the pinned version and exports npm_config_manage_package_manager_versions=false. A nested `pnpm exec` then runs as the older global pnpm, which executes from the workspace root instead of the target cwd, so cwd-relative specs, globs and configs are not found ("Could not find ''"). Call tsx and playwright directly (run-commands already puts node_modules/.bin on PATH), quote the harness glob so Node expands it, guard against pnpm exec returning, and run the performance harness in CI's unit/typecheck job. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 9 +++++++++ apps/electron-backend-e2e/project.json | 16 ++++++++-------- .../performance-build-config.spec.ts | 19 ++++++++++++++++--- .../xtream-benchmark-configuration.spec.ts | 2 +- docs/architecture/validation-map.md | 7 ++++++- 5 files changed, 40 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5a9381a6..07c0fd2b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -435,6 +435,15 @@ jobs: - name: Check i18n drift run: pnpm run i18n:check + # Node specs for the benchmark and journey harness (about ten + # seconds). They live in the E2E app, which the unit coverage scope + # below treats as out of scope, so this step is not gated by it. + - name: Test the performance harness + run: pnpm nx run electron-backend-e2e:test-performance-harness --skip-nx-cache + env: + CI: true + NX_TASKS_RUNNER_DYNAMIC_OUTPUT: false + # A pull request whose changes cannot reach any Tier A test (docs, # notes, other workflows, website, E2E and mock-server apps, release # and packaging tooling, a scripts-only package.json edit) skips the diff --git a/apps/electron-backend-e2e/project.json b/apps/electron-backend-e2e/project.json index 0ff4ff951..82e200a4f 100644 --- a/apps/electron-backend-e2e/project.json +++ b/apps/electron-backend-e2e/project.json @@ -16,7 +16,7 @@ "executor": "nx:run-commands", "options": { "cwd": "apps/electron-backend-e2e", - "command": "pnpm exec tsx --test src/performance/*.spec.ts" + "command": "tsx --test \"src/performance/*.spec.ts\"" } }, "benchmark-m3u-refresh-cancellation": { @@ -26,7 +26,7 @@ "parallelism": false, "options": { "cwd": "apps/electron-backend-e2e", - "command": "pnpm exec playwright test --config=playwright.performance.config.ts src/m3u-refresh-cancellation.performance.ts" + "command": "playwright test --config=playwright.performance.config.ts src/m3u-refresh-cancellation.performance.ts" } }, "benchmark-m3u-import": { @@ -36,7 +36,7 @@ "parallelism": false, "options": { "cwd": "apps/electron-backend-e2e", - "command": "pnpm exec playwright test --config=playwright.performance.config.ts src/m3u-import.performance.ts" + "command": "playwright test --config=playwright.performance.config.ts src/m3u-import.performance.ts" } }, "benchmark-xtream": { @@ -46,7 +46,7 @@ "parallelism": false, "options": { "cwd": "apps/electron-backend-e2e", - "command": "pnpm exec playwright test --config=playwright.xtream-performance.config.ts src/xtream.performance.ts" + "command": "playwright test --config=playwright.xtream-performance.config.ts src/xtream.performance.ts" } }, "benchmark-charset-parse": { @@ -55,7 +55,7 @@ "parallelism": false, "options": { "cwd": "apps/electron-backend-e2e", - "command": "pnpm exec tsx --expose-gc --tsconfig tsconfig.json src/performance/charset-parse.benchmark.ts" + "command": "tsx --expose-gc --tsconfig tsconfig.json src/performance/charset-parse.benchmark.ts" } }, "journeys": { @@ -65,7 +65,7 @@ "parallelism": false, "options": { "cwd": "apps/electron-backend-e2e", - "command": "pnpm exec playwright test --config=playwright.journeys.config.ts" + "command": "playwright test --config=playwright.journeys.config.ts" } }, "packaged-frame-copy-smoke": { @@ -78,14 +78,14 @@ ], "options": { "cwd": "apps/electron-backend-e2e", - "command": "pnpm exec playwright test --config=playwright.packaged.config.ts src/embedded-mpv-frame-copy-packaged.e2e.ts" + "command": "playwright test --config=playwright.packaged.config.ts src/embedded-mpv-frame-copy-packaged.e2e.ts" } }, "test-packaged-frame-copy-fixtures": { "executor": "nx:run-commands", "options": { "cwd": "apps/electron-backend-e2e", - "command": "pnpm exec tsx --test src/embedded-mpv-frame-copy-packaged-fixtures.spec.ts" + "command": "tsx --test src/embedded-mpv-frame-copy-packaged-fixtures.spec.ts" } }, "lint": { diff --git a/apps/electron-backend-e2e/src/performance/performance-build-config.spec.ts b/apps/electron-backend-e2e/src/performance/performance-build-config.spec.ts index 34f157d5a..86eddec02 100644 --- a/apps/electron-backend-e2e/src/performance/performance-build-config.spec.ts +++ b/apps/electron-backend-e2e/src/performance/performance-build-config.spec.ts @@ -88,10 +88,23 @@ test('the performance harness target runs only Node performance specs', () => { assert.equal(target.options?.['cwd'], 'apps/electron-backend-e2e'); assert.equal( target.options?.['command'], - 'pnpm exec tsx --test src/performance/*.spec.ts' + 'tsx --test "src/performance/*.spec.ts"' ); }); +// A nested `pnpm exec` under `pnpm nx` can run from the workspace root instead +// of the target cwd (an older global pnpm with version switching disabled), so +// cwd-relative globs, specs and configs are not found. run-commands already +// puts node_modules/.bin on PATH. +test('electron-backend-e2e command targets call binaries without pnpm exec', () => { + for (const [name, target] of Object.entries(e2eProject.targets)) { + const command = target.options?.['command']; + if (typeof command !== 'string') continue; + + assert.doesNotMatch(command, /\bpnpm exec\b/, name); + } +}); + test('the web performance build keeps production renderer behavior with profiling source maps', () => { const build = webProject.targets['build']; const production = build.configurations?.['production']; @@ -242,7 +255,7 @@ test('the cancellation benchmark command is pinned to its Playwright test file', assert.equal( target.options?.['command'], - 'pnpm exec playwright test --config=playwright.performance.config.ts src/m3u-refresh-cancellation.performance.ts' + 'playwright test --config=playwright.performance.config.ts src/m3u-refresh-cancellation.performance.ts' ); }); @@ -283,7 +296,7 @@ test('the initial M3U import benchmark command is pinned to its Playwright test assert.equal( target.options?.['command'], - 'pnpm exec playwright test --config=playwright.performance.config.ts src/m3u-import.performance.ts' + 'playwright test --config=playwright.performance.config.ts src/m3u-import.performance.ts' ); }); diff --git a/apps/electron-backend-e2e/src/performance/xtream-benchmark-configuration.spec.ts b/apps/electron-backend-e2e/src/performance/xtream-benchmark-configuration.spec.ts index 8a2a4566b..425c72cf7 100644 --- a/apps/electron-backend-e2e/src/performance/xtream-benchmark-configuration.spec.ts +++ b/apps/electron-backend-e2e/src/performance/xtream-benchmark-configuration.spec.ts @@ -346,7 +346,7 @@ describe('Xtream Playwright and Nx plumbing', () => { assert.equal(target?.['parallelism'], false); assert.equal( (target?.['options'] as Record)?.['command'], - 'pnpm exec playwright test --config=playwright.xtream-performance.config.ts src/xtream.performance.ts' + 'playwright test --config=playwright.xtream-performance.config.ts src/xtream.performance.ts' ); assert.equal( (entrypoint.match(/runXtreamBenchmark\(\)/g) ?? []).length, diff --git a/docs/architecture/validation-map.md b/docs/architecture/validation-map.md index 212b58406..7c5ff1fd3 100644 --- a/docs/architecture/validation-map.md +++ b/docs/architecture/validation-map.md @@ -264,7 +264,12 @@ target `master` and for `master` pushes (dispatch it with journey spec against the Xtream mock: J1 launch, then J2 open-source (a second set of launches, each followed by the click on the portal card), both written to the same summary file; its probe specs run with -`pnpm nx run electron-backend-e2e:test-performance-harness`. The contract, what +`pnpm nx run electron-backend-e2e:test-performance-harness`, which CI runs in +the `Unit Tests and Typechecks` job of `ci.yml` on every run. The +`electron-backend-e2e` command targets call `tsx` and `playwright` directly, +not through `pnpm exec`: under `pnpm nx`, a nested `pnpm exec` can run from the +workspace root instead of the target `cwd` and miss cwd-relative specs, globs +and configs. The contract, what counts and how to add a counter or a journey are in the [performance journeys](performance-journeys.md) document.