title: Karma Coverage + RequireJS: Misleading coverage reports
body: <p>Today I've integrated Karma Coverage to my existing RequireJS application. I added the <strong>karma-requirejs</strong> plugin and I was able to successfully get the coverage reports.</p>
  
  <p>Initially the report was very good, almost 100% coverage. When I carefully analyzed the results I noticed a lot of missing files from my "src" folder which led to this extremely good report. </p>
  
  <p>It turns out that the coverage is just applying the analysis for the "src" files that have a corresponding spec (because I use <strong>require</strong>('someFileFromSrcFolder') inside that spec).</p>
  
  <p><strong>Question</strong>: Is there a way for the coverage to analyze all the files from "src" folder?</p>
  
  <p><strong>Karma-conf.js</strong></p>
  
  <pre><code>module.exports = function (config) {
      config.set({
          basePath: '../',
          autoWatch: true,
          singleRun: false,
          frameworks: ['jasmine', 'requirejs'],
          browsers: ['PhantomJS', 'Chrome'],
          logLevel: config.LOG_ERROR,
          files: [
              {pattern: 'vendor/**/*.js', included: false},
              {pattern: 'vendor/**/*.html', included: false},
              {pattern: 'src/**/*.js', included: false},
              {pattern: 'src/**/*.html', included: false},
              {pattern: 'tests/mock/**/*.js', included: false},
              {pattern: 'tests/**/*Specs.js', included: false},
  
              'tests/test-require.js'
          ],
  
          // list of files to exclude
          exclude: [
              'src/app-require.js'
          ],
  
          reporters: ['progress', 'coverage'],
  
          preprocessors: {
              'src/**/*.js': ['coverage']
          }
      });
  };
  </code></pre>
  
  <p><strong>Test-require.js</strong></p>
  
  <pre><code>var allTestFiles = [];
  var TEST_REGEXP = /Specs\.js$/;
  
  Object.keys(window.__karma__.files).forEach(function (file) {
      if (TEST_REGEXP.test(file)) {
          allTestFiles.push(file);
      } 
  });
  
  require.config({
  
      baseUrl: '/base/',
  
      paths: {
         ...
      },
  
      deps: allTestFiles,
  
      callback: window.__karma__.start(),
  
  waitSeconds: 20
  });
  </code></pre>