Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

index.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. Copyright 2012-2015, Yahoo Inc.
  3. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
  4. */
  5. 'use strict';
  6. const { ReportBase } = require('istanbul-lib-report');
  7. class LcovOnlyReport extends ReportBase {
  8. constructor(opts) {
  9. super();
  10. this.file = opts.file || 'lcov.info';
  11. this.projectRoot = opts.projectRoot || process.cwd();
  12. this.contentWriter = null;
  13. }
  14. onStart(root, context) {
  15. this.contentWriter = context.writer.writeFile(this.file);
  16. }
  17. onDetail(node) {
  18. const fc = node.getFileCoverage();
  19. const writer = this.contentWriter;
  20. const functions = fc.f;
  21. const functionMap = fc.fnMap;
  22. const lines = fc.getLineCoverage();
  23. const branches = fc.b;
  24. const branchMap = fc.branchMap;
  25. const summary = node.getCoverageSummary();
  26. const path = require('path');
  27. writer.println('TN:'); //no test nam
  28. writer.println('SF:' + path.relative(this.projectRoot, fc.path));
  29. Object.values(functionMap).forEach(meta => {
  30. writer.println('FN:' + [meta.decl.start.line, meta.name].join(','));
  31. });
  32. writer.println('FNF:' + summary.functions.total);
  33. writer.println('FNH:' + summary.functions.covered);
  34. Object.entries(functionMap).forEach(([key, meta]) => {
  35. const stats = functions[key];
  36. writer.println('FNDA:' + [stats, meta.name].join(','));
  37. });
  38. Object.entries(lines).forEach(entry => {
  39. writer.println('DA:' + entry.join(','));
  40. });
  41. writer.println('LF:' + summary.lines.total);
  42. writer.println('LH:' + summary.lines.covered);
  43. Object.entries(branches).forEach(([key, branchArray]) => {
  44. const meta = branchMap[key];
  45. const { line } = meta.loc.start;
  46. branchArray.forEach((b, i) => {
  47. writer.println('BRDA:' + [line, key, i, b].join(','));
  48. });
  49. });
  50. writer.println('BRF:' + summary.branches.total);
  51. writer.println('BRH:' + summary.branches.covered);
  52. writer.println('end_of_record');
  53. }
  54. onEnd() {
  55. this.contentWriter.close();
  56. }
  57. }
  58. module.exports = LcovOnlyReport;