title: Executing ng test chromeHeadLess fails in jenkins
body: <p>I have a project in <strong>Angular 9</strong> and so unit tests with karma.
  When I execute my tests locally, everything work fine but not in Jenkins.</p>
  
  <p>My goal is to have the junit report to use in Jenkins.</p>
  
  <p>In Jenkins I have the following error</p>
  
  <pre><code>10:03:47  + npm run test
  10:03:47  
  10:03:47  &gt; dclic_frontend@0.1.0 test /var/jenkins_home/workspace/dclic_frontend_master
  10:03:47  &gt; ng test --watch false --code-coverage
  10:03:47  
  10:03:47  Node.js version v11.14.0 detected.
  10:03:47  The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.
  10:03:47  
  10:03:47  Please update your Node.js version or visit https://nodejs.org/ for additional instructions.
  10:03:47  
  10:03:47  npm ERR! code ELIFECYCLE
  10:03:47  npm ERR! errno 3
  10:03:47  npm ERR! dclic_frontend@0.1.0 test: `ng test --watch false --code-coverage`
  10:03:47  npm ERR! Exit status 3
  </code></pre>
  
  <p>I increased timemout in karma.conf.js -> no effect</p>
  
  <p>Here the <strong>package.json</strong></p>
  
  <pre><code>{
    "name": "dclic_frontend",
    "version": "0.1.0",
    "scripts": {
      "ng": "ng",
      "start": "ng serve --base-href /coa/",
      "build": "ng build -- --base-href /coa/ --output-path=build/dist",
      "build:prod": "ng build --configuration=production --base-href /coa/ --output-path=build/dist",
      "test": "ng test --watch false --code-coverage",
      "test:dev": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e",
      "postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
    },
    "private": true,
    "dependencies": {
      "@angular/animations": "^9.1.9",
      "@angular/cdk": "^9.2.4",
      "@angular/common": "^9.1.9",
      "@angular/compiler": "^9.1.9",
      "@angular/core": "^9.1.9",
      "@angular/forms": "^9.1.9",
      "@angular/localize": "^9.1.9",
      "@angular/material": "^9.2.4",
      "@angular/platform-browser": "^9.1.9",
      "@angular/platform-browser-dynamic": "^9.1.9",
      "@angular/router": "^9.1.9",
      "core-js": "^2.6.9",
      "ngx-spinner": "^9.0.2",
      "ngx-toastr": "^12.1.0",
      "rxjs": "~6.5.4",
      "tslib": "^1.10.0",
      "zone.js": "~0.10.2"
    },
    "devDependencies": {
      "@angular-devkit/build-angular": "^0.800.6",
      "@angular/cli": "^9.1.7",
      "@angular/compiler-cli": "^9.1.9",
      "@types/jasmine": "~3.5.0",
      "@types/jasminewd2": "~2.0.3",
      "@types/node": "^12.12.43",
      "codelyzer": "^5.1.2",
      "jasmine-core": "~3.5.0",
      "jasmine-spec-reporter": "~4.2.1",
      "karma": "^4.1.0",
      "karma-chrome-launcher": "~2.2.0",
      "karma-coverage-istanbul-reporter": "~2.0.5",
      "karma-jasmine": "~2.0.1",
      "karma-jasmine-html-reporter": "^1.4.2",
      "karma-junit-reporter": "^1.2.0",
      "protractor": "~5.4.3",
      "ts-node": "~8.3.0",
      "tslint": "~6.1.0",
      "typescript": "~3.8.3"
    }
  }
  </code></pre>
  
  <p>The <strong>karma.conf.js</strong></p>
  
  <pre><code>module.exports = function (config) {
    config.set(
      {
        basePath: '',
        frameworks: ['jasmine', '@angular-devkit/build-angular'],
        plugins: [
          'karma-jasmine',
          'karma-chrome-launcher',
          'karma-jasmine-html-reporter',
          'karma-junit-reporter',
          'karma-coverage-istanbul-reporter',
          '@angular-devkit/build-angular/plugins/karma'
        ],
        client: {
          clearContext: false
        },
        reporters: ['junit', 'progress', 'kjhtml'],
  
        junitReporter: {
          browserNoActivityTimeout:100000,
          outputDir: '../test-reports',
          outputFile: 'junit-report.xml',
          useBrowserName: false,
        },
  
        angularCli: {
          environment: 'dev'
        },
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
  
        browsers: ['MyHeadlessChrome'],
        autoWatch: false,
        singleRun: true,
  
        coverageIstanbulReporter: {
          reports: ['html', 'lcov', 'cobertura'],
          fixWebpackSourcePaths: true,
          dir: 'coverage',
          file: 'cobertura-coverage.xml'
        },
  
        customLaunchers: {
          MyHeadlessChrome: {
            base: 'ChromeHeadless',
            flags: [
              '–no-sandbox',
              '--disable-translate',
              '--disable-extensions',
              '--remote-debugging-port=9223',
              '--headless'
            ]
          }
        },
        captureTimeout: 210000,
        browserDisconnectTolerance: 3,
        browserDisconnectTimeout : 210000,
        browserNoActivityTimeout : 210000
      });
  };
  </code></pre>
  
  <p>The polyfill.js</p>
  
  <pre><code>import '@angular/localize/init';
  import 'zone.js/dist/zone'; // Included with Angular CLI.
  ```code
    "test": {
            "builder": "@angular-devkit/build-angular:karma",
            "options": {
              "main": "src/test.ts",
              "polyfills": "src/polyfills.ts",
              "tsConfig": "tsconfig.spec.json",
              "karmaConfig": "src/karma.conf.js",
              "assets": [
                "src/favicon.ico",
                "src/assets"
              ],
              "styles": [
                "src/styles.scss",
                "node_modules/ngx-toastr/toastr.css"
              ],
              "scripts": [],
              "codeCoverage": true
            }
          },
  </code></pre>
  
  <p>And the stage in <strong>Jenkinsfile</strong> where I commented the post of the report for now.</p>
  
  <pre><code>  stage('Angular frontend Karma Test') {
            steps {
                sh 'npm rebuild'
                sh 'npm run test'
           }
           // post {
           //   always {
           //       junit 'test-reports/junit-report.xml'
           //   }
           //}
          }
  </code></pre>
  
  <p>I have no idea of the origin of this issue.</p>