<commit_before>import { getGlobalVariable } from '../../utils/env';
import { appendToFile } from '../../utils/fs';
import {
  execAndWaitForOutputToMatch,
  killAllProcesses,
  waitForAnyProcessOutputToMatch,
} from '../../utils/process';

const webpackGoodRegEx = /: Compiled successfully./;

export default async function() {
  if (process.platform.startsWith('win')) {
    return;
  }

  let error;
  try {
    await execAndWaitForOutputToMatch('ng', ['serve', '--prod'], webpackGoodRegEx);

      // Should trigger a rebuild.
    await appendToFile('src/environments/environment.prod.ts', `console.log('PROD');`);
    await waitForAnyProcessOutputToMatch(webpackGoodRegEx, 45000);
  } catch (e) {
    error = e;
  }

  killAllProcesses();
  if (error) {
    throw error;
  }
}
<commit_msg>test: delay file change for rebuilds to avoid flakes<commit_after>import { getGlobalVariable } from '../../utils/env';
import { appendToFile } from '../../utils/fs';
import {
  execAndWaitForOutputToMatch,
  killAllProcesses,
  waitForAnyProcessOutputToMatch,
} from '../../utils/process';

const webpackGoodRegEx = /: Compiled successfully./;

export default async function() {
  if (process.platform.startsWith('win')) {
    return;
  }

  let error;
  try {
    await execAndWaitForOutputToMatch('ng', ['serve', '--prod'], webpackGoodRegEx);

    // delay file change by 1 second
    await new Promise(resolve => setTimeout(resolve, 1000));

    // Should trigger a rebuild.
    await appendToFile('src/environments/environment.prod.ts', `console.log('PROD');`);
    await waitForAnyProcessOutputToMatch(webpackGoodRegEx, 45000);
  } catch (e) {
    error = e;
  }

  killAllProcesses();
  if (error) {
    throw error;
  }
}

{'fraction_non_alphanumeric': 0.14692218350754935, 'fraction_numerical': 0.008710801393728223, 'mean_word_length': 3.7205479452054795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4438297', 'n_tokens_mistral': 552, 'n_tokens_neox': 545, 'n_words': 123}