Skip to content

Commit

Permalink
Enable coverage on JS file for all preprocessors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehdy Dara committed Sep 3, 2015
1 parent a784056 commit 9042dfd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
52 changes: 28 additions & 24 deletions app/templates/_karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,8 @@ module.exports = function(config) {
whitelist: [path.join(conf.paths.tmp, '/**/!(*.html|*.spec|*.mock).js')]
<% } -%>
},

reporters: ['progress', 'coverage'],

preprocessors: {
'src/**/*.html': ['ng-html2js'],
<% if (props.jsPreprocessor.key === 'noJsPrepro') { -%>
'src/**/!(*.spec).js': ['coverage']
<% } else { -%>
'.tmp/**/!(*.spec).js': ['coverage']
<% } -%>
},

coverageReporter: {
type : 'html',
dir : 'coverage/'
},
<% } else { -%>
frameworks: ['jasmine'],

reporters: ['progress'],

preprocessors: {
'src/**/*.html': ['ng-html2js']
},
<% } -%>

<% if(props.jsPreprocessor.key === 'traceur') { -%>
Expand All @@ -95,13 +73,39 @@ module.exports = function(config) {
'karma-phantomjs-launcher',
<% } if (props.jsPreprocessor.key === 'noJsPrepro' || props.jsPreprocessor.key === 'coffee') { -%>
'karma-angular-filesort',
'karma-coverage',
<% } -%>
'karma-coverage',
'karma-jasmine',
'karma-ng-html2js-preprocessor'
]
],

coverageReporter: {
type : 'html',
dir : 'coverage/'
},

reporters: ['progress', 'coverage']
};

var preprocessors = {};
<% if (props.jsPreprocessor.key === 'none') { -%>
var pathSrcJs = path.join(conf.paths.src, '/**/!(*.spec).js');
var pathSrcHtml = path.join(conf.paths.src, '/**/*.html');

preprocessors[pathSrcJs] = ['coverage'];
preprocessors[pathSrcHtml] = ['ng-html2js'];
<% } else if (props.jsPreprocessor.key === 'coffee') { -%>
var pathTmpJs = path.join(conf.paths.tmp, '/**/!(*.spec).js');

preprocessors[pathTmpJs] = ['coverage'];
<% } else { -%>
var pathTmpJs = path.join(conf.paths.tmp, '/serve/app/index.module.js');

preprocessors[pathTmpJs] = ['coverage'];
<% } -%>

configuration.preprocessors = preprocessors;

// This block is needed to execute Chrome on Travis
// If you ever plan to use Chrome and Travis, you can keep it
// If not, you can safely remove it
Expand Down
2 changes: 1 addition & 1 deletion app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
"karma-phantomjs-launcher": "~0.2.0",
<% } if (props.jsPreprocessor.srcExtension === 'js' || props.jsPreprocessor.srcExtension === 'coffee') { -%>
"karma-angular-filesort": "~0.1.0",
"karma-coverage": "~0.4.1",
<% } -%>
"karma-coverage": "~0.4.1",
"karma-ng-html2js-preprocessor": "~0.1.2",
"concat-stream": "~1.5.0",
"require-dir": "~0.3.0",
Expand Down

0 comments on commit 9042dfd

Please sign in to comment.