|
1 | | -(function (lcovParse, Q, Joi, logger, path) { |
| 1 | +(function (lcovParse, Q, Joi, logger, util, path) { |
2 | 2 | 'use strict'; |
3 | 3 | var lcovStringValidation = Joi.string().required(), |
4 | 4 | optionsValidation = Joi.object().keys().optional(); |
|
45 | 45 | totalHits += stats.lines.hit; |
46 | 46 |
|
47 | 47 | // The API uses integers only, so convert accordingly. |
48 | | - fileStats.total = Math.floor((stats.lines.hit / stats.lines.found) * 100); |
| 48 | + console.log("pilas" + stats.lines.hit + '/' + stats.lines.found); |
| 49 | + |
| 50 | + fileStats.total = Math.floor(util.safeDivision(stats.lines.hit, stats.lines.found) * 100); |
49 | 51 |
|
50 | 52 | //TODO: Convert to reduce function |
51 | 53 | stats.lines.details.forEach(function (detail) { |
|
61 | 63 | }); |
62 | 64 |
|
63 | 65 | // The API uses integers only, so convert accordingly. |
64 | | - result.total = Math.floor((totalHits / totalLines) * 100); |
| 66 | + result.total = Math.floor(util.safeDivision(totalHits, totalLines) * 100); |
65 | 67 |
|
66 | 68 | logger.debug('Successfully Parsed Lcov Data'); |
67 | 69 |
|
|
71 | 73 | return deferred.promise; |
72 | 74 | } |
73 | 75 | }; |
74 | | -}(require('lcov-parse'), require('q'), require('joi'), require('../logger')(), require('path'))); |
| 76 | +}(require('lcov-parse'), require('q'), require('joi'), require('../logger')(), require('../util'), require('path'))); |
0 commit comments