title: Exclude *.component.ts files from test coverage using Karma
body: <p><a href="https://i.stack.imgur.com/P9e41.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P9e41.png" alt="app_component_Coverage"></a></p>
  
  <p>I want to exclude all the component.ts files from my test coverage and cover only service.ts files in any level of subfolder.
  I have tried number of options commented out in the below code snippet but none worked for me.
  Seeking help from experts to achieve my goal.</p>
  
  <pre><code>module.exports = function (config) {
    config.set({
      files: [
        // '**/*.service.ts'
      ],
      basePath: '',
      frameworks: ['jasmine', '@angular-devkit/build-angular'],
      plugins: [
        require('karma-jasmine'),
        require('karma-coverage'),
        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/new-tts-ui'),
        reports: ['html', 'lcovonly', 'text-summary'],
        fixWebpackSourcePaths: true
      },
      reporters: ['progress', 'coverage'],
      preprocessors: {
        //'**/*.service.ts': ['coverage']
        //'**/*!(component).js' : ['coverage']  
       // '**/*.service.ts': ['coverage']
      },
      port: 9876,
      autoWatch: true,
      browsers: ['Chrome'],
      singleRun: false,
      restartOnFileChange: true,
      //exclude: ['/**/*.component.ts','/**/*.component.js']
      //exclude: ['src/*/{*.js,!(src)/**/*.service.ts}']
      exclude: ['**/*.component.ts', '**/*.component.js']
    });
  };
  </code></pre>