hunk.code_window:     await host.delete(join(host.root(), 'src', 'app', 'app.component.ts')).toPromise();
       const run = await architect.scheduleTarget(target);
       const output = await run.result;
       expect(output.success).toBe(false);
       expect(await host.exists(join(host.root(), 'dist')).toPromise()).toBe(false);
       await run.stop();
     });
  
hunk.labels: keep keep keep keep keep replace keep keep keep
hunk.after_edit:     expect(await host.exists(join(host.root(), 'dist/file.txt')).toPromise()).toBe(false);
  
hunk.file_path: packages/angular_devkit/build_angular/src/builders/browser/specs/output-path_spec.ts
hunk.type: replace
file: /**
   * @license
   * Copyright Google LLC All Rights Reserved.
   *
   * Use of this source code is governed by an MIT-style license that can be
   * found in the LICENSE file at https://angular.io/license
   */
  
  import * as net from 'net';
  import { loadEsmModule } from './load-esm';
  import { isTTY } from './tty';
  
  function createInUseError(port: number): Error {
    return new Error(`Port ${port} is already in use. Use '--port' to specify a different port.`);
  }
  
  export async function checkPort(port: number, host: string): Promise<number> {
    if (port === 0) {
      return 0;
    }
  
    return new Promise<number>((resolve, reject) => {
      const server = net.createServer();
  
      server
        .once('error', (err: NodeJS.ErrnoException) => {
          if (err.code !== 'EADDRINUSE') {
            reject(err);
  
            return;
          }
  
          if (!isTTY) {
            reject(createInUseError(port));
  
            return;
          }
  
          loadEsmModule<typeof import('inquirer')>('inquirer')
            .then(({ default: { prompt } }) =>
              prompt({
                type: 'confirm',
                name: 'useDifferent',
                message: `Port ${port} is already in use.\nWould you like to use a different port?`,
                default: true,
              }),
            )
            .then(
              (answers) => (answers.useDifferent ? resolve(0) : reject(createInUseError(port))),
              () => reject(createInUseError(port)),
            );
        })
        .once('listening', () => {
          server.close();
          resolve(port);
        })
        .listen(port, host);
    });
  }
  