MCPcopy Index your code
hub / github.com/angular/angular-cli / execAndWaitForOutputToMatch

Function execAndWaitForOutputToMatch

tests/e2e/utils/process.ts:329–357  ·  view source on GitHub ↗
(
  cmd: string,
  args: string[],
  match: RegExp,
  env?: NodeJS.ProcessEnv,
)

Source from the content-addressed store, hash-verified

327}
328
329export async function execAndWaitForOutputToMatch(
330 cmd: string,
331 args: string[],
332 match: RegExp,
333 env?: NodeJS.ProcessEnv,
334) {
335 if (cmd === 'ng' && args[0] === 'serve') {
336 // Accept matches up to 20 times after the initial match.
337 // Useful because the Webpack watcher can rebuild a few times due to files changes that
338 // happened just before the build (e.g. `git clean`).
339 // This seems to be due to host file system differences, see
340 // https://nodejs.org/docs/latest/api/fs.html#fs_caveats
341 const maxRetries = 20;
342 let lastResult = await _exec({ waitForMatch: match, env }, cmd, args);
343
344 for (let i = 0; i < maxRetries; i++) {
345 try {
346 lastResult = await waitForAnyProcessOutputToMatch(match, 2500);
347 } catch {
348 // If we timeout (no new match found), we assume the process is stable.
349 break;
350 }
351 }
352
353 return lastResult;
354 } else {
355 return _exec({ waitForMatch: match, env }, cmd, args);
356 }
357}
358
359export function ng(...args: string[]) {
360 const argv = getGlobalVariable('argv');

Callers 15

ngServeFunction · 0.90
executeBrowserTestFunction · 0.90
unknown-option.tsFile · 0.90
cache-info.tsFile · 0.90
completion.tsFile · 0.90
reload-shims.tsFile · 0.90

Calls 2

_execFunction · 0.85

Tested by

no test coverage detected