title: Angular 8 - Headless Chrome running twice and failing second time
body: <p>Locally my test cases are running fine with Chrome, No issues. I want to run my test cases on my build server ( Microsoft Azure ).</p>
  
  <p>On my server builds, test cases are running twice. I want to run them only once.</p>
  
  <p>I am passing configuration as HeadlessChrome. These are my configurations.</p>
  
  <p>In package.json file,</p>
  
  <pre><code>"test": "ng test --code-coverage --watch=false --browsers ChromeHeadless",
  </code></pre>
  
  <p>my karma.conf.js file,</p>
  
  <pre><code>// Karma configuration file, see link for more information
  // https://karma-runner.github.io/1.0/config/configuration-file.html
  
  module.exports = function (config) {
    config.set({
      basePath: '',
      frameworks: ['jasmine', '@angular-devkit/build-angular'],
      plugins: [
        require('karma-jasmine'),
        require('karma-chrome-launcher'),
        require('karma-jasmine-html-reporter'),
        require('karma-coverage-istanbul-reporter'),
        require('@angular-devkit/build-angular/plugins/karma')
      ],
  
      // customLaunchers: {
      //   'ChromeHeadless_Sandbox': {
      //       base: 'ChromeHeadless',
      //       flags: [
  
      //           '--no-sandbox',
  
      //       ],
      //      debug: true
      //   },
      // },
  
      client:{
        clearContext: false // leave Jasmine Spec Runner output visible in browser
      },
      coverageIstanbulReporter: {
        dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
        fixWebpackSourcePaths: true
      },
  
      reporters: ['progress'],
      port: 9876,
      colors: true,
      logLevel: config.LOG_INFO,
      browsers: ['ChromeHeadless'],
      autoWatch: false,
      concurrency: Infinity,
      singleRun: true, // Karma captures browsers, runs the tests and exits
    });
  };
  </code></pre>
  
  <p>Error:</p>
  
  <p><a href="https://i.stack.imgur.com/mb1nn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mb1nn.png" alt="enter image description here"></a></p>
  
  <p>There is a total of 131 test cases. 8 are skipped and remaining pass properly. It runs the second time and it does not work. The server shows all test cases as failed. </p>
  
  <p>I have been exploring all answers on StackOverflow and Github for similar problems but still, test cases are running twice. Both times it is running for HeadlessChrome which is fine but it should run once and exit.</p>
  
  <p>PS - There is also some commented code on which I am testing and trying different ways. </p>
  
  <p>Please help. Where did I go wrong? How can I make test cases running only once? </p>