Skip to content

Commit

Permalink
Merge branch 'ly-cultureiq-add_cobertura_support'
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmerwin committed Nov 21, 2019
2 parents ee636f6 + e48a66d commit 51890f8
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 31 deletions.
5 changes: 4 additions & 1 deletion lib/convertLcovToCoveralls.js
Expand Up @@ -4,6 +4,7 @@ const fs = require('fs');
const path = require('path');
const lcovParse = require('lcov-parse');
const logger = require('./logger')();
const coberturaParse = require('cobertura-parse');

const detailsToCoverage = (length, details) => {
const coverage = new Array(length);
Expand Down Expand Up @@ -53,7 +54,9 @@ const convertLcovToCoveralls = (input, options, cb) => {
let filepath = options.filepath || '';
logger.debug('in: ', filepath);
filepath = path.resolve(process.cwd(), filepath);
lcovParse(input, (err, parsed) => {
const filetype = options.filetype || 'lcov';
const parser = filetype === 'cobertura' ? coberturaParse.parseContent : lcovParse;
parser(input, (err, parsed) => {
if (err) {
logger.error('error from lcovParse: ', err);
logger.error('input: ', input);
Expand Down
134 changes: 104 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -36,6 +36,7 @@
"Adam Moss (https://github.com/adam-moss)"
],
"dependencies": {
"cobertura-parse": "^1.0.5",
"js-yaml": "^3.13.1",
"lcov-parse": "^1.0.0",
"log-driver": "^1.2.7",
Expand Down

0 comments on commit 51890f8

Please sign in to comment.