index.js 762 B

12345678910111213141516171819202122232425262728
  1. /*
  2. Copyright 2012-2015, Yahoo Inc.
  3. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
  4. */
  5. const LcovOnlyReport = require('../lcovonly');
  6. const 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(what => {
  12. const meth = 'on' + what;
  13. LcovReport.prototype[meth] = function(...args) {
  14. const lcov = this.lcov;
  15. const html = this.html;
  16. if (lcov[meth]) {
  17. lcov[meth](...args);
  18. }
  19. if (html[meth]) {
  20. html[meth](...args);
  21. }
  22. };
  23. });
  24. module.exports = LcovReport;