Skip to content

Commit 78f9013

Browse files
committed
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.
1 parent 985aa18 commit 78f9013

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/legacy-cli/e2e/utils/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ ts_project(
1919
"//:node_modules/verdaccio",
2020
"//:node_modules/verdaccio-auth-memory",
2121
"//tests:node_modules/@types/tar-stream",
22-
"//tests:node_modules/rxjs",
2322
"//tests:node_modules/tar-stream",
2423
"//tests:node_modules/tree-kill",
2524
],

tests/legacy-cli/e2e/utils/process.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { spawn, SpawnOptions } from 'node:child_process';
22
import * as child_process from 'node:child_process';
3-
import { concat, defer, EMPTY, from, lastValueFrom, catchError, repeat } from 'rxjs';
43
import { getGlobalVariable, getGlobalVariablesEnv } from './env';
54
import treeKill from 'tree-kill';
65
import { delimiter, join, resolve } from 'node:path';
@@ -310,7 +309,7 @@ export async function execAndCaptureError(
310309
}
311310
}
312311

313-
export function execAndWaitForOutputToMatch(
312+
export async function execAndWaitForOutputToMatch(
314313
cmd: string,
315314
args: string[],
316315
match: RegExp,
@@ -322,15 +321,19 @@ export function execAndWaitForOutputToMatch(
322321
// happened just before the build (e.g. `git clean`).
323322
// This seems to be due to host file system differences, see
324323
// https://nodejs.org/docs/latest/api/fs.html#fs_caveats
325-
return lastValueFrom(
326-
concat(
327-
from(_exec({ waitForMatch: match, env }, cmd, args)),
328-
defer(() => waitForAnyProcessOutputToMatch(match, 2500)).pipe(
329-
repeat(20),
330-
catchError(() => EMPTY),
331-
),
332-
),
333-
);
324+
const maxRetries = 20;
325+
let lastResult = await _exec({ waitForMatch: match, env }, cmd, args);
326+
327+
for (let i = 0; i < maxRetries; i++) {
328+
try {
329+
lastResult = await waitForAnyProcessOutputToMatch(match, 2500);
330+
} catch {
331+
// If we timeout (no new match found), we assume the process is stable.
332+
break;
333+
}
334+
}
335+
336+
return lastResult;
334337
} else {
335338
return _exec({ waitForMatch: match, env }, cmd, args);
336339
}

tests/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"devDependencies": {
33
"@types/tar-stream": "3.1.4",
44
"@angular-devkit/schematics": "workspace:*",
5-
"rxjs": "7.8.2",
65
"tar-stream": "3.1.7",
76
"tree-kill": "1.2.2"
87
}

0 commit comments

Comments
 (0)