From a34a04502098a2e625c206c82226f7c2a020180b Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 5 Dec 2025 11:03:04 -0500 Subject: [PATCH] test: remove RxJS from E2E process utility Replaces RxJS-based retry logic in `execAndWaitForOutputToMatch` with standard async/await for better readability and reduced dependency footprint. --- pnpm-lock.yaml | 3 --- tests/legacy-cli/e2e/utils/BUILD.bazel | 1 - tests/legacy-cli/e2e/utils/process.ts | 25 ++++++++++++++----------- tests/package.json | 1 - 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6250ae36c084..481f893a0420 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -891,9 +891,6 @@ importers: '@types/tar-stream': specifier: 3.1.4 version: 3.1.4 - rxjs: - specifier: 7.8.2 - version: 7.8.2 tar-stream: specifier: 3.1.7 version: 3.1.7 diff --git a/tests/legacy-cli/e2e/utils/BUILD.bazel b/tests/legacy-cli/e2e/utils/BUILD.bazel index a565262640c4..093a4f832092 100644 --- a/tests/legacy-cli/e2e/utils/BUILD.bazel +++ b/tests/legacy-cli/e2e/utils/BUILD.bazel @@ -19,7 +19,6 @@ ts_project( "//:node_modules/verdaccio", "//:node_modules/verdaccio-auth-memory", "//tests:node_modules/@types/tar-stream", - "//tests:node_modules/rxjs", "//tests:node_modules/tar-stream", "//tests:node_modules/tree-kill", ], diff --git a/tests/legacy-cli/e2e/utils/process.ts b/tests/legacy-cli/e2e/utils/process.ts index ce4eb8291ab2..91216843086a 100644 --- a/tests/legacy-cli/e2e/utils/process.ts +++ b/tests/legacy-cli/e2e/utils/process.ts @@ -1,6 +1,5 @@ import { spawn, SpawnOptions } from 'node:child_process'; import * as child_process from 'node:child_process'; -import { concat, defer, EMPTY, from, lastValueFrom, catchError, repeat } from 'rxjs'; import { getGlobalVariable, getGlobalVariablesEnv } from './env'; import treeKill from 'tree-kill'; import { delimiter, join, resolve } from 'node:path'; @@ -310,7 +309,7 @@ export async function execAndCaptureError( } } -export function execAndWaitForOutputToMatch( +export async function execAndWaitForOutputToMatch( cmd: string, args: string[], match: RegExp, @@ -322,15 +321,19 @@ export function execAndWaitForOutputToMatch( // happened just before the build (e.g. `git clean`). // This seems to be due to host file system differences, see // https://nodejs.org/docs/latest/api/fs.html#fs_caveats - return lastValueFrom( - concat( - from(_exec({ waitForMatch: match, env }, cmd, args)), - defer(() => waitForAnyProcessOutputToMatch(match, 2500)).pipe( - repeat(20), - catchError(() => EMPTY), - ), - ), - ); + const maxRetries = 20; + let lastResult = await _exec({ waitForMatch: match, env }, cmd, args); + + for (let i = 0; i < maxRetries; i++) { + try { + lastResult = await waitForAnyProcessOutputToMatch(match, 2500); + } catch { + // If we timeout (no new match found), we assume the process is stable. + break; + } + } + + return lastResult; } else { return _exec({ waitForMatch: match, env }, cmd, args); } diff --git a/tests/package.json b/tests/package.json index 9a87c1c637b8..17660ff2192e 100644 --- a/tests/package.json +++ b/tests/package.json @@ -2,7 +2,6 @@ "devDependencies": { "@types/tar-stream": "3.1.4", "@angular-devkit/schematics": "workspace:*", - "rxjs": "7.8.2", "tar-stream": "3.1.7", "tree-kill": "1.2.2" }