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 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 JsonReport extends ReportBase {
  8. constructor(opts) {
  9. super();
  10. this.file = opts.file || 'coverage-final.json';
  11. this.first = true;
  12. }
  13. onStart(root, context) {
  14. this.contentWriter = context.writer.writeFile(this.file);
  15. this.contentWriter.write('{');
  16. }
  17. onDetail(node) {
  18. const fc = node.getFileCoverage();
  19. const key = fc.path;
  20. const cw = this.contentWriter;
  21. if (this.first) {
  22. this.first = false;
  23. } else {
  24. cw.write(',');
  25. }
  26. cw.write(JSON.stringify(key));
  27. cw.write(': ');
  28. cw.write(JSON.stringify(fc));
  29. cw.println('');
  30. }
  31. onEnd() {
  32. const cw = this.contentWriter;
  33. cw.println('}');
  34. cw.close();
  35. }
  36. }
  37. module.exports = JsonReport;