This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
53 lines
1.4 KiB
/* |
|
Copyright 2012-2015, Yahoo Inc. |
|
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. |
|
*/ |
|
var Reporter = require('./reporter'), |
|
fs = require('fs'), |
|
filesFor = require('./file-matcher').filesFor, |
|
libCoverage = require('istanbul-lib-coverage'); |
|
|
|
function run(formats, config, opts, callback) { |
|
if (!callback && typeof(opts) === 'function') { |
|
callback = opts; |
|
opts = {}; |
|
} |
|
opts = opts || {}; |
|
var root, |
|
coverageMap = libCoverage.createCoverageMap(), |
|
includePattern = opts.include || '**/coverage*.raw.json', |
|
reporter = new Reporter(config); |
|
|
|
if (!formats || formats.length === 0) { |
|
formats = config.reporting.reports(); |
|
} |
|
try { |
|
reporter.addAll(formats); |
|
} catch (ex) { |
|
ex.inputError = true; |
|
return callback(ex); |
|
} |
|
|
|
root = opts.root || process.cwd(); |
|
filesFor({ |
|
root: root, |
|
includes: [ includePattern ] |
|
}, function (err, files) { |
|
/* istanbul ignore if */ |
|
if (err) { |
|
return callback(err); |
|
} |
|
files.forEach(function (file) { |
|
var coverageObject = JSON.parse(fs.readFileSync(file, 'utf8')); |
|
coverageMap.merge(coverageObject); |
|
}); |
|
reporter.write(coverageMap, {}); |
|
return callback(); |
|
}); |
|
} |
|
|
|
module.exports = { |
|
run: run |
|
}; |
|
|
|
|
|
|