Sha256: ce7011638191fdfaa41a1e1957dfa21959b066d7ec91fbe42c456d26d3e03921
Contents?: true
Size: 876 Bytes
Versions: 36
Compression:
Stored size: 876 Bytes
Contents
/** * Module dependencies. */ var JSONCov = require('./json-cov') , fs = require('fs'); /** * Expose `HTMLCov`. */ exports = module.exports = HTMLCov; /** * Initialize a new `JsCoverage` reporter. * * @param {Runner} runner * @api public */ function HTMLCov(runner) { var jade = require('jade') , file = __dirname + '/templates/coverage.jade' , str = fs.readFileSync(file, 'utf8') , fn = jade.compile(str, { filename: file }) , self = this; JSONCov.call(this, runner, false); runner.on('end', function(){ process.stdout.write(fn({ cov: self.cov , coverageClass: coverageClass })); }); } /** * Return coverage class for `n`. * * @return {String} * @api private */ function coverageClass(n) { if (n >= 75) return 'high'; if (n >= 50) return 'medium'; if (n >= 25) return 'low'; return 'terrible'; }
Version data entries
36 entries across 36 versions & 1 rubygems