diff options
| author | Levi Yurkowicz <[email protected]> | 2019-10-31 17:51:47 -0400 |
|---|---|---|
| committer | Levi Yurkowicz <[email protected]> | 2019-10-31 17:51:47 -0400 |
| commit | 593d1be7855993f0ec4c34fbf8e7f2673304edd5 (patch) | |
| tree | 9856ba17c5301a51167c6c878db91120bbaff700 /lib | |
| parent | 2ed185ca3626591549ed33c2363a47b824a39d0f (diff) | |
| download | node-coveralls-593d1be7855993f0ec4c34fbf8e7f2673304edd5.tar.xz node-coveralls-593d1be7855993f0ec4c34fbf8e7f2673304edd5.zip | |
add ability to parse cobertura files
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/convertLcovToCoveralls.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/convertLcovToCoveralls.js b/lib/convertLcovToCoveralls.js index 521e749..815c85b 100644 --- a/lib/convertLcovToCoveralls.js +++ b/lib/convertLcovToCoveralls.js @@ -1,6 +1,7 @@ var TRAVIS_JOB_ID = process.env.TRAVIS_JOB_ID || 'unknown'; var fs = require('fs'); var lcovParse = require('lcov-parse'); +var coberturaParse = require('cobertura-parse'); var path = require('path'); var logger = require('./logger')(); @@ -47,11 +48,13 @@ var cleanFilePath = function(file) { var convertLcovToCoveralls = function(input, options, cb){ var filepath = options.filepath || ''; + var filetype = options.filetype || 'lcov'; + var parser = filetype === 'cobertura' ? coberturaParse.parseContent : lcovParse; logger.debug("in: ", filepath); filepath = path.resolve(process.cwd(), filepath); - lcovParse(input, function(err, parsed){ + parser(input, function(err, parsed){ if (err){ - logger.error("error from lcovParse: ", err); + logger.error("error from " + filetype + "Parse: ", err); logger.error("input: ", input); return cb(err); } |
