title: Karma not running tests on Jenkins
body: <p>I am new to CI/CD and Jenkins.
  I am working on setting up CI/CD for an Angular application.
  It uses the default test runner which is Karma.
  I have a step that runs the tests in ChromeHeadless mode.
  My Jenkins pipeline is as below</p>
  <pre><code>pipeline {
  agent any
  tools {nodejs &quot;node&quot;}
  
  environment {
    NO_PROXY=&quot;localhost, 0.0.0.0/4201, 0.0.0.0/9876&quot;
  }
  
  stages {
      stage('Install') {
          steps {
              sh 'rm -rf node_modules'
              sh 'rm package-lock.json'
              sh 'rm -rf dist'
              sh 'npm install --legacy-peer-deps'
          }
      }
  
      stage('Test') {
          steps {
              sh 'npm run test-headless'
          }
      }
  
  }
  </code></pre>
  <p>}</p>
  <p>And in the package.json I have a script as below:</p>
  <pre><code>&quot;test-headless&quot;: &quot;ng test --browsers ChromeHeadless&quot;
  </code></pre>
  <p>The config is as below:</p>
  <pre><code>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')
      ],
      client: {
        clearContext: false // leave Jasmine Spec Runner output visible in browser
      },
      coverageIstanbulReporter: {
        dir: require('path').join(__dirname, './coverage/instone'),
        reports: ['html', 'lcovonly', 'text-summary'],
        fixWebpackSourcePaths: true
      },
      reporters: ['progress', 'kjhtml'],
      port: 9876,
      colors: true,
      logLevel: config.LOG_INFO,
      autoWatch: true,
      browsers: ['ChromeHeadless'],
      customLaunchers: {
        ChromeHeadless: {
        base: 'Chrome',
        flags: [
          '--headless',
          '--disable-gpu',
          '--no-sandbox',
          '--remote-debugging-port=9222'
        ]
        }
    },
      singleRun: true,
      restartOnFileChange: true
    });
  };
  </code></pre>
  <p>However I am getting the below error</p>
  <p><a href="https://i.stack.imgur.com/x4Ggw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x4Ggw.png" alt="enter image description here" /></a></p>
  <p>I'd appreciate any assistance.</p>