index.js 827 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. Copyright 2012-2015, Yahoo Inc.
  3. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
  4. */
  5. var LcovOnlyReport = require('../lcovonly'),
  6. HtmlReport = require('../html');
  7. function LcovReport() {
  8. this.lcov = new LcovOnlyReport({file: 'lcov.info'});
  9. this.html = new HtmlReport({ subdir: 'lcov-report'});
  10. }
  11. ['Start', 'End', 'Summary', 'SummaryEnd', 'Detail'].forEach(function (what) {
  12. var meth = 'on' + what;
  13. LcovReport.prototype[meth] = function () {
  14. var args = Array.prototype.slice.call(arguments),
  15. lcov = this.lcov,
  16. html = this.html;
  17. if (lcov[meth]) {
  18. lcov[meth].apply(lcov, args);
  19. }
  20. if (html[meth]) {
  21. html[meth].apply(html, args);
  22. }
  23. };
  24. });
  25. module.exports = LcovReport;